pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:143:   #define mt_destroy(X) usfreelock((*X), /*******/)      #define th_setconcurrency(X) /*******/      #define PIKE_SPROC_FLAGS (PR_SADDR|PR_SFDS|PR_SDIR|PS_SETEXITSIG)   #define th_create(ID, fun, arg) (((*(ID)) = sproc(fun, PIKE_SPROC_FLAGS, arg)) == -1)   #define th_create_small(ID, fun, arg) (((*(ID)) = sproc(fun, PIKE_SPROC_FLAGS, arg)) == -1)   #define th_exit(X) exit(X)   #define th_self() getpid()   #define th_yield() sginap(0) + #define th_equal(X,Y) ((X)==(Y)) + #define th_hash(X) ((unsigned INT32)(X))      /*    * No cond_vars yet    */      #endif /* SGI_SPROC_THREADS */         #ifdef NT_THREADS   #include <process.h>   #include <windows.h>      #define THREAD_T HANDLE   #define th_setconcurrency(X)   #define th_create(ID,fun,arg) (!(*(ID)=_beginthread(fun, 2*1024*1024, arg)))   #define th_create_small(ID,fun,arg) (!(*(ID)=_beginthread(fun, 32768, arg)))   #define th_exit(foo) _endthread(foo)   #define th_self() GetCurrentThread()   #define th_destroy(X)   #define th_yield() Sleep(0) -  + #define th_equal(X,Y) ((X)==(Y)) + #define th_hash(X) ((unsigned INT32)(X))      #define MUTEX_T HANDLE   #define mt_init(X) CheckValidHandle((*(X)=CreateMutex(NULL, 0, NULL)))   #define mt_lock(X) (CheckValidHandle(*(X)),WaitForSingleObject(*(X), INFINITE))   #define mt_trylock(X) (CheckValidHandle(*(X)),WaitForSingleObject(*(X), 0))   #define mt_unlock(X) (CheckValidHandle(*(X)),ReleaseMutex(*(X)))   #define mt_destroy(X) (CheckValidHandle(*(X)),CloseHandle(*(X)))      #define EVENT_T HANDLE   #define event_init(X) CheckValidHandle(*(X)=CreateEvent(NULL, 1, 0, NULL))
pike.git/src/threads.h:243:   };      #ifndef th_destroy   #define th_destroy(X)   #endif      #ifndef th_yield   #define th_yield()   #endif    + #ifndef th_equal + #define th_equal(X,Y) (!MEMCPY(&(X),&(Y),sizeof(THREAD_T))) + #endif +  + #ifndef th_hash + #define th_hash(X) hashmem(&(X),sizeof(THREAD_T), 16) + #endif +    /* Define to get a debug-trace of some of the threads operations. */   /* #define VERBOSE_THREADS_DEBUG */      #ifndef VERBOSE_THREADS_DEBUG   #define THREADS_FPRINTF(X)   #else   #define THREADS_FPRINTF(X) fprintf X   #endif /* VERBOSE_THREADS_DEBUG */      #define SWAP_OUT_THREAD(_tmp) do { \