pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:1:   /* -  * $Id: threads.h,v 1.52 1998/08/31 12:48:33 grubba Exp $ +  * $Id: threads.h,v 1.53 1998/09/05 20:08:27 grubba Exp $    */   #ifndef THREADS_H   #define THREADS_H      #include "machine.h"   #include "interpret.h"   #include "object.h"   #include "error.h"   #ifdef HAVE_SYS_TYPES_H   /* Needed for pthread_t on OSF/1 */
pike.git/src/threads.h:77:   #define th_yield()   #endif /* HAVE_PTHREAD_YIELD */   extern pthread_attr_t pattr;   extern pthread_attr_t small_pattr;      #define th_create(ID,fun,arg) pthread_create(ID,&pattr,fun,arg)   #define th_create_small(ID,fun,arg) pthread_create(ID,&small_pattr,fun,arg)   #define th_exit(foo) pthread_exit(foo)   #define th_self() pthread_self()   #define th_kill(ID,sig) pthread_kill((ID),(sig)) + #define th_join(ID,res) pthread_join((ID),(res))   #ifdef HAVE_PTHREAD_COND_INIT   #define COND_T pthread_cond_t      #ifdef HAVE_PTHREAD_CONDATTR_DEFAULT_AIX   /* AIX wants the & ... */   #define co_init(X) pthread_cond_init((X), &pthread_condattr_default)   #else /* !HAVE_PTHREAD_CONDATTR_DEFAULT_AIX */   #ifdef HAVE_PTHREAD_CONDATTR_DEFAULT   /* ... while FreeBSD doesn't. */   #define co_init(X) pthread_cond_init((X), pthread_condattr_default)
pike.git/src/threads.h:123:   #define mt_destroy(X) mutex_destroy(X)      #define th_setconcurrency(X) thr_setconcurrency(X)      #define th_create(ID,fun,arg) thr_create(NULL,thread_stack_size,fun,arg,THR_DAEMON|THR_DETACHED,ID)   #define th_create_small(ID,fun,arg) thr_create(NULL,32768,fun,arg,THR_DAEMON|THR_DETACHED,ID)   #define th_exit(foo) thr_exit(foo)   #define th_self() thr_self()   #define th_kill(ID,sig) thr_kill((ID),(sig))   #define th_yield() thr_yield() + #define th_join(ID,res) thr_join((ID), NULL, (res))      #define COND_T cond_t   #define co_init(X) cond_init((X),USYNC_THREAD,0)   #define co_wait(COND, MUTEX) cond_wait((COND), (MUTEX))   #define co_signal(X) cond_signal(X)   #define co_broadcast(X) cond_broadcast(X)   #define co_destroy(X) cond_destroy(X)         #endif /* UNIX_THREADS */
pike.git/src/threads.h:155:   #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_join(ID,res) /*********/   #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_join(ID,res) /******************* FIXME! ****************/   #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))