void FreeDebug( struct TDebug *obj ) { free( obj->FProgram ); free( obj->FParam ); free( obj->FStartDir ); RdosCloseWait( obj->UserWait ); RdosFreeSignal( obj->UserSignal ); RdosDeleteSection( obj->FSection ); }
static void FiniHandle( void ) { int i; for( i = 0; i < handle_count; i++ ) if( handle_ptr[i] ) FreeHandleObj( handle_ptr[i] ); lib_free( handle_ptr ); RdosDeleteSection( handle_section ); }
_WCRTLINK void __CloseSemaphore( semaphore_object *obj ) { #if defined( __RUNTIME_CHECKS__ ) && defined( _M_IX86 ) // 0 is ok // 1 is ok // JBS I don't think so. I would mean a critical section is active. // JBS For every lock, there should be an unlock. // if( obj->count >= 2 ) { // __fatal_runtime_error( "Semaphore locked too many times", 1 ); // } if( obj->count >= 1 ) { __fatal_runtime_error( "Semaphore not unlocked", 1 ); } #endif #if !defined( __NT__ ) #if defined( _M_I86 ) if( obj->count > 0 ) { DosSemClear( &obj->semaphore ); } #else if( obj->initialized != 0 ) { #if defined( __NETWARE__ ) obj->semaphore = 0; #elif defined( __QNX__ ) __qsem_destroy( &obj->semaphore ); #elif defined( __LINUX__ ) // TODO: Close the semaphore for Linux! #elif defined( __RDOS__ ) RdosDeleteSection( obj->semaphore ); obj->semaphore = 0; #elif defined( __RDOSDEV__ ) #else DosCloseMutexSem( obj->semaphore ); #endif } #endif obj->initialized = 0; obj->owner = 0; obj->count = 0; #endif }