… | |
… | |
83 | static xmutex_t wrklock; |
83 | static xmutex_t wrklock; |
84 | static xmutex_t reslock; |
84 | static xmutex_t reslock; |
85 | static xmutex_t reqlock; |
85 | static xmutex_t reqlock; |
86 | static xcond_t reqwait; |
86 | static xcond_t reqwait; |
87 | |
87 | |
|
|
88 | struct etp_tmpbuf |
|
|
89 | { |
|
|
90 | void *ptr; |
|
|
91 | int len; |
|
|
92 | }; |
|
|
93 | |
|
|
94 | static void * |
|
|
95 | etp_tmpbuf_get (struct etp_tmpbuf *buf, int len) |
|
|
96 | { |
|
|
97 | if (buf->len < len) |
|
|
98 | { |
|
|
99 | free (buf->ptr); |
|
|
100 | buf->ptr = malloc (buf->len = len); |
|
|
101 | } |
|
|
102 | |
|
|
103 | return buf->ptr; |
|
|
104 | } |
|
|
105 | |
88 | typedef struct etp_worker |
106 | typedef struct etp_worker |
89 | { |
107 | { |
90 | struct tmpbuf tmpbuf; |
108 | struct etp_tmpbuf tmpbuf; |
91 | |
109 | |
92 | /* locked by wrklock */ |
110 | /* locked by wrklock */ |
93 | struct etp_worker *prev, *next; |
111 | struct etp_worker *prev, *next; |
94 | |
112 | |
95 | xthread_t tid; |
113 | xthread_t tid; |