Added a condwait example.
Added memory deallocation routines.