00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef ICACHE_H
00023 #define ICACHE_H
00024
00025 #include <stddef.h>
00026 #include <sexp.h>
00027 #include "../SEAP/generic/rbt/rbt.h"
00028
00029 #ifndef PROBE_IQUEUE_CAPACITY
00030 #define PROBE_IQUEUE_CAPACITY 1024
00031 #endif
00032
00033 typedef struct {
00034 SEXP_t *cobj;
00035 union {
00036 SEXP_t *item;
00037 pthread_cond_t *cond;
00038 } p;
00039 } probe_iqpair_t;
00040
00041 typedef struct {
00042 rbt_t *tree;
00043 pthread_t thid;
00044
00045 pthread_mutex_t queue_mutex;
00046 pthread_cond_t queue_notempty;
00047 pthread_cond_t queue_notfull;
00048
00049 probe_iqpair_t queue[PROBE_IQUEUE_CAPACITY];
00050 uint16_t queue_beg;
00051 uint16_t queue_end;
00052 uint16_t queue_cnt;
00053 uint16_t queue_max;
00054 } probe_icache_t;
00055
00056 typedef struct {
00057 SEXP_t **item;
00058 uint16_t count;
00059 } probe_citem_t;
00060
00061 probe_icache_t *probe_icache_new(void);
00062 int probe_icache_add(probe_icache_t *cache, SEXP_t *cobj, SEXP_t *item);
00063 int probe_icache_nop(probe_icache_t *cache);
00064 void probe_icache_free(probe_icache_t *cache);
00065
00066 #endif