Exemplo n.º 1
0
long fnInitializeThreadCtx(void)
{
        int index = 0;
        //long tid;

        if (!g_tCtxSem) {
                #ifdef MPK_ON
                        g_tCtxSem = kSemaphoreAlloc((BYTE *)"threadCtx", 1);
                #else
                        g_tCtxSem = OpenLocalSemaphore(1);
                #endif	//MPK_ON

                g_ThreadCtx =NULL;
        }

        return 0l;
}
Exemplo n.º 2
0
extern int __CBeginThread( thread_fn *start_addr, void *stack_bottom,
                         unsigned stack_size, void *arglist )
{
    begin_thread_data   data;

    data.start_addr = start_addr;
    data.stack_bottom = stack_bottom;
    data.arglist = arglist;
    data.semaphore = OpenLocalSemaphore( 0 );
    if( BeginThread( &begin_thread_helper,
                     stack_bottom, stack_size, &data ) != -1 ) {
        WaitOnLocalSemaphore( data.semaphore );
    } else {
        data.tid = -1;
    }
    CloseLocalSemaphore( data.semaphore );
    return( data.tid );
}
Exemplo n.º 3
0
void fnInitializeThreadInfo(void)
{
        int index = 0;

        if (g_tinfoSem)
                return;

        #ifdef MPK_ON
                g_tinfoSem = kSemaphoreAlloc((BYTE *)"threadInfo", 1);
        #else
                g_tinfoSem = OpenLocalSemaphore(1);
        #endif	//MPK_ON
        

        for (index = 0; index < NUM_ENTRIES; index++)
                g_ThreadInfo[index] = NULL;

        return;
}
Exemplo n.º 4
0
int     __InitFThreadProcessing( void ) {
//=======================================

// Setup for multiple threads.

#if defined( __OS2__ )
    DosCreateMutexSem( NULL, &__fio_sem, 0, FALSE );
#elif defined( __NETWARE__ )
    __fio_sem = OpenLocalSemaphore( 1 );
#elif defined( __NT__ )
    __fio_sem = CreateMutex( NULL, FALSE, NULL );
#elif defined( __LINUX__ )
// TODO: semaphore support for Linux!
#endif
    _AccessFIO  = &__AccessFIO;
    _ReleaseFIO = &__ReleaseFIO;
    _PartialReleaseFIO = &__PartialReleaseFIO;
    __InitMultiThreadIO();
    return( 0 );
}
Exemplo n.º 5
0
		TraceCriticalSection()
		{
			m_sem = OpenLocalSemaphore(1);
		};