X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fpthread_extra%2Fpthread_extra.h;h=0652e0a568e146bc71844db1477f1c11f57b5a97;hb=883427014d5349442395c1059af5a1abade951ad;hp=e1fe782cec638133d401592152c7c582644e7a59;hpb=5251b63c80878b87d8cb808efd3978bd819c4f8b;p=mirrors%2FPrograms.git diff --git a/c/pthread_extra/pthread_extra.h b/c/pthread_extra/pthread_extra.h index e1fe782..0652e0a 100644 --- a/c/pthread_extra/pthread_extra.h +++ b/c/pthread_extra/pthread_extra.h @@ -2,13 +2,46 @@ #define __PTHREAD_EXTRA_H__ #include -#include #include #include +#include +//#include #define PTHREAD_XTIME_NOBLOCK (&(struct timespec){ .tv_sec = 0, .tv_nsec = 0 }) #define PTHREAD_XTIME_FOREVER NULL +// User data + +#define PTHREAD_XTHREADS_MAX 65535 +#define PTHREAD_XNULL ((pthread_t)NULL) + +#ifdef __PTHREAD_EXTRA_INTERNAL +typedef struct pthread_user_data_internal_t { + pthread_t tid; //Thread ID + sig_atomic_t running; //Internaly used by pthread_pause + void *usr; //User pointer +} pthread_user_data_internal_t; + +pthread_user_data_internal_t* pthread_user_data_internal(pthread_t thread); +#endif //__PTHREAD_EXTRA_INTERNAL + +void** pthread_user_data_ptr(pthread_t thread); +void* pthread_user_data_get(pthread_t thread); +void pthread_user_data_set(pthread_t thread, void *usr); + +// Pausing + +//GDB: handle SIG34 nostop noprint +#define PTHREAD_XSIG_STOP (SIGRTMIN+0) +#define PTHREAD_XSIG_CONT (SIGRTMIN+1) +#define PTHREAD_XSIGRTMIN (SIGRTMIN+2) //First unused RT signal + +void pthread_unpause_handler(); +void pthread_pause_handler(); +void pthread_pause_enable(); +int pthread_pause(pthread_t thread); +int pthread_unpause(pthread_t thread); + // Message queues #define PTHREAD_XMQ_FRONT true