pike.git / src / threads.h

version» Context lines:

pike.git/src/threads.h:1:   /* -  * $Id: threads.h,v 1.66 1999/05/08 00:41:03 hubbe Exp $ +  * $Id: threads.h,v 1.67 1999/05/12 04:45:59 hubbe 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:174:      #endif /* SGI_SPROC_THREADS */         #ifdef NT_THREADS   #include <process.h>   #include <windows.h>      #define THREAD_T unsigned   #define th_setconcurrency(X) - #define th_create(ID,fun,arg) (!_beginthreadex(NULL, 2*1024*1024,fun, arg,0,ID)) - #define th_create_small(ID,fun,arg) (!_beginthreadex(NULL, 8192*sizeof(char *), fun,arg,0,ID)) + #define th_create(ID,fun,arg) low_nt_create_thread(2*1024*1024,fun, arg,ID) + #define th_create_small(ID,fun,arg) low_nt_create_thread(8192*sizeof(char *), fun,arg,ID)   #define TH_RETURN_TYPE unsigned __stdcall - #define th_exit(foo) _endthread(foo) + #define TH_STDCALL __stdcall + #define th_exit(foo) _endthreadex(foo)   #define th_join(ID,res) /******************* FIXME! ****************/   #define th_self() GetCurrentThreadId()   #define th_destroy(X)   #define th_yield() Sleep(0)   #define th_equal(X,Y) ((X)==(Y))   #define th_hash(X) (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 mt_lock(X) WaitForSingleObject(CheckValidHandle(*(X)), INFINITE) + #define mt_trylock(X) WaitForSingleObject(CheckValidHandle(*(X)), 0) + #define mt_unlock(X) ReleaseMutex(CheckValidHandle(*(X))) + #define mt_destroy(X) CloseHandle(CheckValidHandle(*(X)))      #define EVENT_T HANDLE   #define event_init(X) CheckValidHandle(*(X)=CreateEvent(NULL, 1, 0, NULL)) - #define event_signal(X) (CheckValidHandle(*(X)),SetEvent(*(X))) - #define event_destroy(X) (CheckValidHandle(*(X)),CloseHandle(*(X))) - #define event_wait(X) (CheckValidHandle(*(X)),WaitForSingleObject(*(X), INFINITE)) + #define event_signal(X) SetEvent(CheckValidHandle(*(X))) + #define event_destroy(X) CloseHandle(CheckValidHandle(*(X))) + #define event_wait(X) WaitForSingleObject(CheckValidHandle(*(X)), INFINITE)      #endif         #if !defined(COND_T) && defined(EVENT_T) && defined(MUTEX_T)      #define SIMULATE_COND_WITH_EVENT      struct cond_t_queue   {
pike.git/src/threads.h:314: Inside #if defined(THREAD_TRACE)
     #ifdef THREAD_TRACE    int t_flag;   #endif /* THREAD_TRACE */   };      #ifndef TH_RETURN_TYPE   #define TH_RETURN_TYPE void *   #endif    + #ifndef TH_STDCALL + #define TH_STDCALL + #endif +    #ifndef th_destroy   #define th_destroy(X)   #endif      #ifndef th_yield   #define th_yield()   #endif      #ifndef th_equal   #define th_equal(X,Y) (!MEMCMP(&(X),&(Y),sizeof(THREAD_T)))
pike.git/src/threads.h:510:   #define ASSERT_THREAD_SWAPPED_IN() do { \    struct thread_state *_tmp=thread_state_for_id(th_self()); \    if(_tmp->swapped) fatal("Thread is not swapped in!\n"); \    }while(0)      #else   #define ASSERT_THREAD_SWAPPED_IN()   #endif      /* Prototypes begin here */ + int low_nt_create_thread(unsigned stack_size, +  unsigned (TH_STDCALL *func)(void *), +  void *arg, +  unsigned *id);   struct thread_starter; -  + struct thread_local; + void low_init_threads_disable(void); + void init_threads_disable(struct object *o); + void exit_threads_disable(struct object *o); + void init_interleave_mutex(IMUTEX_T *im); + void exit_interleave_mutex(IMUTEX_T *im); + void thread_table_init(void); + unsigned INT32 thread_table_hash(THREAD_T *tid); + void thread_table_insert(struct object *o); + void thread_table_delete(struct object *o); + struct thread_state *thread_state_for_id(THREAD_T tid); + struct object *thread_for_id(THREAD_T tid); + void f_all_threads(INT32 args);   TH_RETURN_TYPE new_thread_func(void * data);   void f_thread_create(INT32 args);   void f_thread_set_concurrency(INT32 args);   void f_this_thread(INT32 args);   struct mutex_storage;   struct key_storage;   void f_mutex_lock(INT32 args);   void f_mutex_trylock(INT32 args);   void init_mutex_obj(struct object *o);   void exit_mutex_obj(struct object *o);
pike.git/src/threads.h:532:   void exit_mutex_key_obj(struct object *o);   void f_cond_wait(INT32 args);   void f_cond_signal(INT32 args);   void f_cond_broadcast(INT32 args);   void init_cond_obj(struct object *o);   void exit_cond_obj(struct object *o);   void f_thread_backtrace(INT32 args);   void f_thread_id_status(INT32 args);   void init_thread_obj(struct object *o);   void exit_thread_obj(struct object *o); - void th_farm(void (*fun)(void *), void *); - void th_init(void); + void f_thread_local(INT32 args); + void f_thread_local_get(INT32 args); + void f_thread_local_set(INT32 args);   void low_th_init(void); -  + void th_init(void);   void th_cleanup(void); - void thread_table_insert(struct object *o); - void thread_table_delete(struct object *o); - struct thread_state *thread_state_for_id(THREAD_T tid); - struct object *thread_for_id(THREAD_T tid); - void f_all_threads(INT32 args); - void f_thread_local(INT32 args); -  - void low_init_threads_disable(void); - void init_threads_disable(struct object *o); - void exit_threads_disable(struct object *o); -  - void init_interleave_mutex(IMUTEX_T *im); - void exit_interleave_mutex(IMUTEX_T *im); -  + int th_num_idle_farmers(void); + int th_num_farmers(); + void th_farm(void (*fun)(void *), void *here);   /* Prototypes end here */      #else   #define th_setconcurrency(X)   #define DEFINE_MUTEX(X)   #define DEFINE_IMUTEX(X)   #define init_interleave_mutex(X)   #define LOCK_IMUTEX(X)   #define UNLOCK_IMUTEX(X)   #define mt_init(X)
pike.git/src/threads.h:587:   #define co_broadcast(X)      #define low_init_threads_disable()   #define init_threads_disable(X)   #define exit_threads_disable(X)      #endif /* _REENTRANT */      #ifdef __NT__   #ifndef PIKE_DEBUG - #define CheckValidHandle(X) 0 + #define CheckValidHandle(X) (X)   #else - void CheckValidHandle(HANDLE h); + HANDLE CheckValidHandle(HANDLE h);   #endif   #endif      extern int threads_disabled;   extern int thread_storage_offset;      #endif /* THREADS_H */