Example #1
0
/**
 * Destroy a thread handle
 *
 * Note: this does NOT stop or destroy the thread, it just releases
 * the handle for accessing it. If this is not done, a memory leak
 * occurs, so if the creator of the thread never needs to communicate
 * with the thread again it should call this immediately after the
 * create if the create was successful.
 *
 * @param  thread  Handle to the thread to destroy
 *
 * @result VXItrdResult 0 on success 
 */
VXITRD_API VXItrdResult VXItrdThreadDestroyHandle(VXItrdThread **thread)
{
  if ((thread == NULL) || (*thread == NULL))
    return VXItrd_RESULT_INVALID_ARGUMENT;

  // Decrement ref count
  VXIulong refs = 0;
  if ((*thread)->refCountMutex) {
    VXItrdMutexLock ((*thread)->refCountMutex);
    (*thread)->refCount--;
    refs = (*thread)->refCount;
    VXItrdMutexUnlock ((*thread)->refCountMutex);
  }

  if (refs == 0) {
    // No longer needed
    if ((*thread)->refCountMutex)
      VXItrdMutexDestroy (&(*thread)->refCountMutex);
    delete *thread;
  }

  *thread = NULL;

  return VXItrd_RESULT_SUCCESS;
}
Example #2
0
// Destructor
SBtrdEvent::~SBtrdEvent( ) 
{ 
  Diag (0, L"SBtrdEvent::~SBtrdEvent", L"enter: this 0x%p", this);
  
  if ( _timer ) 
    VXItrdTimerDestroy (&_timer); 
  if ( _sleepMutex ) 
    VXItrdMutexDestroy (&_sleepMutex); 
}
Example #3
0
/**
 * Global platform shutdown of Log
 *
 * @result VXIlogResult 0 on success
 */
OSBLOG_API VXIlogResult OSBlogShutDown(void)
{
    if (gblInitialized == false)
        return VXIlog_RESULT_FATAL_ERROR;

    // Close the log file
    if (gblLogFile) {
        fclose(gblLogFile);
        gblLogFile = NULL;
    }

    // Destroy the log mutex
    if (gblLogMutex)
        VXItrdMutexDestroy(&gblLogMutex);

    gblInitialized = false;
    return VXIlog_RESULT_SUCCESS;
}
Example #4
0
OSBlog::~OSBlog()
{
    VXItrdMutexDestroy(&callbackLock);
}
Example #5
0
 ~InternalMutex()
 { if (mutex != NULL) VXItrdMutexDestroy(&mutex);  mutex = NULL;  }