pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:13:   #undef HAVE_PTHREAD_H   #undef HAVE_THREAD_H   #endif      #ifdef HAVE_PTHREAD_H   #define POSIX_THREADS   #include <pthread.h>   #undef HAVE_PTHREAD_H   #endif    + #ifdef SPROC_THREADS + /* Not supported yet */ + #undef SPROC_THREADS + #undef HAVE_SPROC + #endif /* SPROC_THREADS */         extern int num_threads;   struct object;   extern struct object *thread_id;      #define DEFINE_MUTEX(X) MUTEX_T X         #ifdef POSIX_THREADS
pike.git/src/threads.h:37:   #define mt_trylock(X) pthread_mutex_trylock(X)   #define mt_unlock(X) pthread_mutex_unlock(X)   #define mt_destroy(X) pthread_mutex_destroy(X)      /* SIGH! No setconcurrency in posix threads. This is more or less    * needed to make usable multi-threaded programs on solaris machines    * with only one CPU. Otherwise, only systemcalls are actually    * threaded.    */   #define th_setconcurrency(X) + #ifdef HAVE_PTHREAD_YIELD + #define th_yield() pthread_yield() + #else   #define th_yield() -  + #endif /* HAVE_PTHREAD_YIELD */    -  +    #define th_create(ID,fun,arg) pthread_create(ID,&pattr,fun,arg)   #define th_exit(foo) pthread_exit(foo)   #define th_self() pthread_self()    -  + #ifdef HAVE_PTHREAD_COND_INIT   #define COND_T pthread_cond_t -  +  + #ifdef HAVE_PTHREAD_CONDATTR_DEFAULT + #define co_init(X) pthread_cond_init((X), pthread_condattr_default) + #else   #define co_init(X) pthread_cond_init((X), 0) -  + #endif /* HAVE_PTHREAD_CONDATTR_DEFAULT */ +    #define co_wait(COND, MUTEX) pthread_cond_wait((COND), (MUTEX))   #define co_signal(X) pthread_cond_signal(X)   #define co_broadcast(X) pthread_cond_broadcast(X)   #define co_destroy(X) pthread_cond_destroy(X) - #endif + #else + #error No way to make cond-vars + #endif /* HAVE_PTHREAD_COND_INIT */    -  + #endif /* POSIX_THREADS */          -  +    #ifdef UNIX_THREADS   #define THREAD_T thread_t   #define PTHREAD_MUTEX_INITIALIZER DEFAULTMUTEX   #define MUTEX_T mutex_t   #define mt_init(X) mutex_init((X),USYNC_THREAD,0)   #define mt_lock(X) mutex_lock(X)   #define mt_trylock(X) mutex_trylock(X)   #define mt_unlock(X) mutex_unlock(X)   #define mt_destroy(X) mutex_destroy(X)   
pike.git/src/threads.h:78:   #define th_exit(foo) thr_exit(foo)   #define th_self() thr_self()   #define th_yield() thr_yield()      #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 +     -  +  + #endif /* UNIX_THREADS */ +  + #ifdef SPROC_THREADS +  + /* +  * Not fully supported yet +  */ + #define THREAD_T int +  + #define MUTEX_T ulock_t + #define mt_init(X) (usinitlock(((*X) = usnewlock(/*********/)))) + #define mt_lock(X) ussetlock(*X) + #define mt_unlock(X) usunsetlock(*X) + #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_exit(X) exit(X) + #define th_self() getpid() + #define th_yield() sginap(0) +  + /* +  * No cond_vars yet +  */ +  + #endif /* SPROC_THREADS */ +    extern MUTEX_T interpreter_lock;         struct svalue;   struct frame;      struct thread_state {    int swapped;    struct svalue *sp,*evaluator_stack;    struct svalue **mark_sp,**mark_stack;
pike.git/src/threads.h:166:   #define DEFINE_MUTEX(X)   #define mt_init(X)   #define mt_lock(X)   #define mt_unlock(X)   #define mt_destroy(X)   #define THREADS_ALLOW()   #define THREADS_DISALLOW()   #define th_init()   #define th_cleanup()   #define th_init_programs() - #endif + #endif /* _REENTRANT */         extern int threads_disabled; - #endif +  + #endif /* THREADS_H */