示例#1
0
/** \brief OS layer deinitialization
 *
 * \b os_osExit calls:
 * - \b os_sharedMemoryExit
 * - \b os_threadExit
 */
void os_osExit (void)
{
  os_uint32 initCount;

  initCount = pa_decrement(&_ospl_osInitCount);

  if (initCount == 0) {
    os_sharedMemoryExit();
    os_threadModuleExit();
    /*os_processModuleExit();*/
    os_reportExit();
    os_mutexModuleExit();
  } else if ((initCount + 1) < initCount){
    /* The 0 boundary is passed, so os_osExit is called more often than
     * os_osInit. Therefore undo decrement as nothing happened and warn. */
    initCount = pa_increment(&_ospl_osInitCount);
    OS_REPORT(OS_WARNING, "os_osExit", 1, "OS-layer not initialized");
    /* Fail in case of DEV, as it is incorrect API usage */
    assert(0);
  }
  return;
}
示例#2
0
文件: os_init.c 项目: osrf/opensplice
void
os_osExit (
    void)
{
    os_uint32 initCount;
#ifndef NDEBUG
    OS_REPORT(OS_INFO, "os__reallocdoublecopycount", 0, "count=%d", vxAtomicGet(&os__reallocdoublecopycount));
#endif
    initCount = pa_dec32_nv(&_ospl_osInitCount);

    if (initCount == 0) {
        os_sharedMemoryExit();
        os_reportExit();
        os_threadModuleExit();
    } else if ((initCount + 1) < initCount){
        /* The 0 boundary is passed, so os_osExit is called more often than
         * os_osInit. Therefore undo decrement as nothing happened and warn. */
        initCount = pa_inc32_nv(&_ospl_osInitCount);
        OS_REPORT(OS_WARNING, "os_osExit", 1, "OS-layer not initialized");
        /* Fail in case of DEV, as it is incorrect API usage */
        assert(0);
    }
    return;
}