00001 #ifndef PROBE_THREAD
00002 #define PROBE_THREAD
00003
00004 #ifndef PROBE_THREAD_DEFAULT_MAX_THREADS
00005 #define PROBE_THREAD_DEFAULT_MAX_THREADS 64
00006 #endif
00007
00008 #ifndef PROBE_THREAD_DEFAULT_MAX_CHDEPTH
00009 #define PROBE_THREAD_DEFAULT_MAX_CHDEPTH 8
00010 #endif
00011
00012 #include <pthread.h>
00013 #include <stdbool.h>
00014 #include "seap.h"
00015 #include "SEAP/generic/rbt/rbt.h"
00016
00017 typedef struct {
00018 SEAP_msgid_t sid;
00019 pthread_t tid;
00021 SEXP_t * (*msg_handler)(SEAP_msg_t *, int *);
00022 SEAP_msg_t *msg;
00023 } probe_thread_t;
00024
00025 typedef struct {
00026 uint32_t flags;
00027 rbt_t *threads;
00028 uint32_t max_threads;
00029 uint32_t max_chdepth;
00030 pthread_t sigthr;
00031 } probe_threadmgr_t;
00032
00033 typedef struct {
00034 probe_threadmgr_t *mgr;
00035 probe_thread_t *pth;
00036 } probe_pmpair_t;
00037
00038 #define PROBE_THREADMGR_FREE 0x00000001
00039
00040
00041 probe_threadmgr_t *probe_threadmgr_new(uint32_t max_threads, uint32_t max_chdepth, probe_threadmgr_t *dst);
00042 void probe_threadmgr_free(probe_threadmgr_t *mgr);
00043 probe_thread_t *probe_thread_new(void);
00044 int probe_thread_create(probe_threadmgr_t *mgr, SEAP_msgid_t sid, SEXP_t * (*msg_handler)(SEAP_msg_t *, int *), SEAP_msg_t *msg);
00045
00046
00047
00048 #endif