MySQL  8.0.21
Source Code Documentation
task.h
Go to the documentation of this file.
1 /* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef TASK_H
24 #define TASK_H
25 
26 #include "xcom/xcom_profile.h"
27 
28 #include <assert.h>
29 #include <errno.h>
30 #ifndef XCOM_STANDALONE
31 #include "my_compiler.h"
32 #endif
33 #include "xcom/simset.h"
34 #include "xcom/task_arg.h"
35 #include "xcom/x_platform.h"
36 #include "xcom/xcom_common.h"
37 
38 #include "xcom/node_connection.h"
39 #include "xcom/result.h"
40 
41 /** \file
42  Rudimentary task system in portable C, based on Tom Duff's switch-based
43  coroutine trick
44  and a stack of environment structs. (continuations?)
45  Nonblocking IO and event handling need to be rewritten for each new OS.
46 */
47 
48 #ifdef TASK_EVENT_TRACE
49 void add_base_event(double when, char const *file, int state);
50 #define ADD_BASE_EVENT \
51  { \
52  add_base_event(seconds(), __FILE__, __LINE__); \
53  add_event(EVENT_DUMP_PAD, string_arg(__func__)); \
54  }
55 
56 #define ADD_DBG(d, x) \
57  if (do_dbg(d)) { \
58  ADD_BASE_EVENT x; \
59  add_event(EVENT_DUMP_PAD, end_arg()); \
60  }
61 
62 #define ADD_EVENTS(x) ADD_DBG(D_BUG, x)
63 
64 #define ADD_T_EV(when, file, state, what)
65 #define ADD_WAIT_EV(when, file, state, what, milli)
66 
67 #else
68 #define ADD_EVENTS(x)
69 #define ADD_DBG(d, x)
70 #define ADD_T_EV(when, file, state, what)
71 #define ADD_WAIT_EV(when, file, state, what, milli)
72 #endif
73 
74 static inline void set_int_arg(task_arg *arg, int value) {
75  arg->type = a_int;
76  arg->val.i = value;
77 }
78 
79 static inline int get_int_arg(task_arg arg) {
80  assert(arg.type == a_int);
81  return arg.val.i;
82 }
83 
84 static inline void set_long_arg(task_arg *arg, long value) {
85  arg->type = a_long;
86  arg->val.l = value;
87 }
88 
89 static inline long get_long_arg(task_arg arg) {
90  assert(arg.type == a_long);
91  return arg.val.l;
92 }
93 
94 static inline void set_uint_arg(task_arg *arg, unsigned int value) {
95  arg->type = a_uint;
96  arg->val.u_i = value;
97 }
98 
99 static inline unsigned int get_uint_arg(task_arg arg) {
100  assert(arg.type == a_uint);
101  return arg.val.u_i;
102 }
103 
104 static inline void set_ulong_arg(task_arg *arg, unsigned long value) {
105  arg->type = a_ulong;
106  arg->val.u_l = value;
107 }
108 
109 static inline void set_ulong_long_arg(task_arg *arg, unsigned long long value) {
110  arg->type = a_ulong_long;
111  arg->val.u_ll = value;
112 }
113 
114 static inline unsigned long get_ulong_arg(task_arg arg) {
115  assert(arg.type == a_ulong);
116  return arg.val.u_l;
117 }
118 
119 static inline unsigned long long get_ulong_long_arg(task_arg arg) {
120  assert(arg.type == a_ulong_long);
121  return arg.val.u_l;
122 }
123 
124 static inline void set_float_arg(task_arg *arg, float value) {
125  arg->type = a_float;
126  arg->val.f = value;
127 }
128 
129 static inline float get_float_arg(task_arg arg) {
130  assert(arg.type == a_float);
131  return arg.val.f;
132 }
133 
134 static inline void set_double_arg(task_arg *arg, double value) {
135  arg->type = a_double;
136  arg->val.d = value;
137 }
138 
139 static inline double get_double_arg(task_arg arg) {
140  assert(arg.type == a_double);
141  return arg.val.d;
142 }
143 
144 static inline void set_string_arg(task_arg *arg, char const *value) {
145  arg->type = a_string;
146  arg->val.s = value;
147 }
148 
149 static inline void set_void_arg(task_arg *arg, void *value) {
150  arg->type = a_void;
151  arg->val.v = value;
152 }
153 
154 static inline char const *get_string_arg(task_arg arg) {
155  assert(arg.type == a_string);
156  return (char const *)arg.val.v;
157 }
158 
159 static inline void *get_void_arg(task_arg arg) {
160  assert(arg.type == a_void);
161  return arg.val.v;
162 }
163 
164 static inline task_arg int_arg(int i) {
165  task_arg retval;
166  set_int_arg(&retval, i);
167  return retval;
168 }
169 
170 static inline task_arg uint_arg(unsigned int i) {
171  task_arg retval;
172  set_uint_arg(&retval, i);
173  return retval;
174 }
175 
176 static inline task_arg ulong_arg(unsigned long l) {
177  task_arg retval;
178  set_ulong_arg(&retval, l);
179  return retval;
180 }
181 
182 static inline task_arg ulong_long_arg(unsigned long long ll) {
183  task_arg retval;
184  set_ulong_long_arg(&retval, ll);
185  return retval;
186 }
187 
188 static inline task_arg double_arg(double i) {
189  task_arg retval;
190  set_double_arg(&retval, i);
191  return retval;
192 }
193 
194 static inline task_arg string_arg(char const *v) {
195  task_arg retval;
196  set_string_arg(&retval, v);
197  return retval;
198 }
199 
200 static inline task_arg void_arg(void *v) {
201  task_arg retval;
202  set_void_arg(&retval, v);
203  return retval;
204 }
205 
206 static inline task_arg end_arg() {
207  task_arg retval;
208  retval.type = a_end;
209  return retval;
210 }
211 
212 /* Combined environment pointer and state variable */
213 struct task_ptr {
214  int state;
215  void *ptr;
216 };
217 
218 typedef struct task_ptr TaskAlign;
219 
220 struct task_env;
221 
222 /* All task functions have this signature */
223 typedef int (*task_func)(task_arg arg);
224 
225 /* Increase this if tasks need bigger stacks, or use a linked list for the stack
226  */
227 #define TASK_POOL_ELEMS 1000
228 
229 typedef enum terminate_enum {
230  RUN = 0,
231  KILL = 1,
234 
235 /* A complete task.
236  The buffer buf is used for a heap which grows upwards and a stack which grows
237  downwards.
238  The stack contains pointers to environment structs, which are allocated from
239  the heap.
240  */
241 struct task_env {
242  linkage l; /* Used for runnable tasks and wait queues */
243  linkage all; /* Links all tasks */
244  int heap_pos; /* Index in time priority queue, necessary for efficient removal
245  */
247  terminate; /* Set this and activate task to make it terminate */
248  int refcnt; /* Number of references to task */
249  int taskret; /* Return value from task function */
250  task_func func; /* The task function */
251  task_arg arg; /* Argument passed to the task */
252  const char *name; /* The task name */
253  TaskAlign *where; /* High water mark in heap */
254  TaskAlign *stack_top; /* The stack top */
255  TaskAlign *sp; /* The current stack pointer */
256  double time; /* Time when the task should be activated */
257  TaskAlign buf[TASK_POOL_ELEMS]; /* Heap and stack */
258  int debug;
259  int waitfd;
260  int interrupt; /* Set if timeout while waiting */
261 };
262 
263 typedef struct task_env task_env;
264 
265 #define MAXTASKS 1000
266 
267 /* Priority queue of task_env */
268 struct task_queue {
269  int curn;
271 };
272 typedef struct task_queue task_queue;
273 
274 #define _ep ((struct env *)(stack->sp->ptr))
275 
276 #define TASK_ALLOC(pool, type) (task_allocate(pool, (unsigned int)sizeof(type)))
277 
278 #if 0
279 #define TASK_DEBUG(x) \
280  if (stack->debug) { \
281  IFDBG(D_NONE, FN; STRLIT(x " task "); PTREXP((void *)stack); \
282  STRLIT(stack->name); NDBG(stack->sp->state, d)); \
283  }
284 #else
285 #define TASK_DEBUG(x)
286 #endif
287 
288 /* Place cleanup code after this label */
289 #define FINALLY \
290  task_cleanup:
291 
292 /* We have reached the top of the stack when sp == stack_top + 1 since the stack
293  * grows downwards */
294 #define ON_STACK_TOP (stack->sp == stack->stack_top + 1)
295 
296 /* If we have climbed the stack to the top, check the terminate flag.
297  Execute cleanup code and exit this stack frame if terminate is set.
298  */
299 #define TERM_CHECK \
300  if (ON_STACK_TOP && stack->terminate) goto task_cleanup
301 
302 #define TERMINATE goto task_cleanup
303 
304 #define TASK_STACK_DEBUG \
305  if (stack->debug) { \
306  char *fnpos = strrchr(__FILE__, DIR_SEP); \
307  if (fnpos) \
308  fnpos++; \
309  else \
310  fnpos = __FILE__; \
311  IFDBG(D_NONE, FN; STRLIT("TASK_BEGIN "); STREXP(stack->name); \
312  STRLIT(fnpos); STRLIT(":"); NPUT(stack->sp->state, d); \
313  NDBG(stack->terminate, d)); \
314  }
315 
316 /* Switch on task state. The first time, allocate a new stack frame and check
317  * for termination */
318 #define TASK_BEGIN \
319  /* assert(ep); */ \
320  ADD_DBG( \
321  D_TASK, \
322  if (stack->sp->state) { \
323  add_event(EVENT_DUMP_PAD, string_arg("state")); \
324  add_event(EVENT_DUMP_PAD, int_arg(stack->sp->state)); \
325  } add_event(EVENT_DUMP_PAD, string_arg("TASK_BEGIN")); \
326  add_event(EVENT_DUMP_PAD, void_arg(stack));); \
327  TASK_DEBUG("TASK_BEGIN"); \
328  switch (stack->sp->state) { \
329  case 0: \
330  pushp(stack, TASK_ALLOC(stack, struct env)); \
331  ep = _ep; \
332  assert(ep); \
333  TERM_CHECK;
334 
335 /* This stack frame is finished, deallocate it and return 0 to signal exit */
336 #define TASK_END \
337  ADD_DBG( \
338  D_TASK, \
339  if (stack->sp->state) { \
340  add_event(EVENT_DUMP_PAD, string_arg("state")); \
341  add_event(EVENT_DUMP_PAD, int_arg(stack->sp->state)); \
342  } add_event(EVENT_DUMP_PAD, string_arg("TASK_END")); \
343  add_event(EVENT_DUMP_PAD, void_arg(stack));); \
344  TASK_DEBUG("TASK_END"); \
345  stack->sp->state = 0; \
346  stack->where = (TaskAlign *)stack->sp->ptr; \
347  assert(stack->where); \
348  popp(stack); \
349  return 0; \
350  } \
351  return 0
352 
353 /* Assign a return value, execute cleanup code, and exit this stack frame */
354 #define TASK_RETURN(x) \
355  { \
356  *ret = (x); \
357  goto task_cleanup; \
358  }
359 
360 #define TASK_DUMP_ERR \
361  if (errno || SOCK_ERRNO || task_errno) { \
362  IFDBG(D_NONE, FN; NDBG(errno, d); STREXP(strerror(errno)); \
363  NDBG(SOCK_ERRNO, d); STREXP(strerror(SOCK_ERRNO)); \
364  NDBG(task_errno, d); STREXP(strerror(task_errno))); \
365  }
366 
367 /* Assign -1 as exit code, execute cleanup code, and exit this stack frame */
368 #define TASK_FAIL \
369  { \
370  *ret = (-1); \
371  TASK_DUMP_ERR; \
372  IFDBG(D_NONE, FN; STRLIT("TASK_FAIL")); \
373  ADD_DBG(D_TASK, add_event(EVENT_DUMP_PAD, string_arg("task failed"))); \
374  goto task_cleanup; \
375  }
376 
377 /* Capture the line number in the state variable, and return.
378  When called again (after the switch label), check for termination.
379 */
380 #define TASK_YIELD \
381  { \
382  TASK_DEBUG("TASK_YIELD"); \
383  stack->sp->state = __LINE__; \
384  return 1; \
385  case __LINE__: \
386  TASK_DEBUG("RETURN FROM YIELD"); \
387  ep = _ep; \
388  assert(ep); \
389  TERM_CHECK; \
390  }
391 
392 #define TASK_DEACTIVATE \
393  { \
394  TASK_DEBUG("TASK_DEACTIVATE"); \
395  task_deactivate(stack); \
396  TASK_YIELD; \
397  }
398 
399 /* Put the task in the queue of tasks waiting for timeout, then yield.
400  Wait until current time + t seconds.
401  */
402 #define TASK_DELAY(t) \
403  { \
404  TASK_DEBUG("TASK_DELAY"); \
405  task_delay_until(seconds() + t); \
406  TASK_YIELD; \
407  }
408 
409 /* Put the task in the queue of tasks waiting for timeout, then yield.
410  Wait until t.
411  */
412 #define TASK_DELAY_UNTIL(t) \
413  { \
414  TASK_DEBUG("TASK_DELAY_UNTIL"); \
415  task_delay_until(t); \
416  TASK_YIELD; \
417  }
418 
419 /* Put the task in a wait queue, then yield */
420 #define TASK_WAIT(queue) \
421  { \
422  TASK_DEBUG("TASK_WAIT"); \
423  task_wait(stack, queue); \
424  TASK_YIELD; \
425  }
426 
427 /* Put the task in a wait queue with timeout, then yield */
428 #define TIMED_TASK_WAIT(queue, t) \
429  { \
430  TASK_DEBUG("TIMED_TASK_WAIT"); \
431  task_delay_until(seconds() + (t)); \
432  task_wait(stack, queue); \
433  TASK_YIELD; \
434  }
435 
436 /* A channel has a queue of data elements and a queue of waiting tasks */
437 struct channel {
440 };
441 
442 typedef struct channel channel;
443 
444 /* Channel construction */
445 channel *channel_init(channel *c, unsigned int type);
446 
447 /* Put data in channel. No wait, since channels can never be full */
448 void channel_put(channel *c, linkage *data); /* Append to queue */
449 void channel_put_front(channel *c,
450  linkage *data); /* Insert in front of queue */
451 
452 /* Wait until there is data in the channel, then extract and cast to type */
453 #define CHANNEL_GET(channel, ptr, type) \
454  { \
455  while (link_empty(&(channel)->data)) { \
456  TASK_WAIT(&(channel)->queue); \
457  } \
458  *(ptr) = (type *)link_extract_first(&(channel)->data); \
459  IFDBG(D_TRANSPORT, FN; STRLIT("CHANNEL_GET "); PTREXP(*(ptr)); \
460  PTREXP(&((channel)->data))); \
461  }
462 
463 #define CHANNEL_PEEK(channel, ptr, type) \
464  { \
465  while (link_empty(&(channel)->data)) { \
466  TASK_WAIT(&(channel)->queue); \
467  } \
468  *(ptr) = (type *)link_first(&(channel)->data); \
469  }
470 
471 #define CHANNEL_GET_REVERSE(channel, ptr, type) \
472  { \
473  while (link_empty(&(channel)->data)) { \
474  TASK_WAIT(&(channel)->queue); \
475  } \
476  *(ptr) = (type *)link_extract_last(&(channel)->data); \
477  }
478 
479 /*
480  The first time, reset the state of the stack frame of the called function.
481  Keep calling the function until it returns 0, which signals exit.
482  Yield after each call.
483  */
484 #define TASK_CALL(funcall) \
485  { \
486  reset_state(stack); \
487  TASK_DEBUG("BEFORE CALL"); \
488  do { \
489  stack->sp--; \
490  stack->taskret = funcall; \
491  stack->sp++; \
492  TERM_CHECK; \
493  if (stack->taskret) TASK_YIELD; \
494  } while (stack->taskret); \
495  TASK_DEBUG("AFTER CALL"); \
496  }
497 
498 /* Define the typeless struct which is the container for all variables in the
499  * stack frame */
500 #define DECL_ENV struct env {
501 /* Define a pointer to the environment struct */
502 #define END_ENV \
503  } \
504  ; \
505  struct env MY_ATTRIBUTE((unused)) * ep
506 
507 /* Try to lock a fd for read or write.
508  Yield and spin until it succeeds.
509 */
510 #define LOCK_FD(fd, op) \
511  { \
512  while (!lock_fd( \
513  fd, stack, \
514  op)) { /* Effectively a spin lock, but should not happen very often */ \
515  wait_io(stack, fd, op); \
516  TASK_YIELD; \
517  /* TASK_DELAY(1.0); */ \
518  } \
519  }
520 
521 /* Unlock a fd */
522 #define UNLOCK_FD(fd, op) unlock_fd(fd, stack, op)
523 
524 #ifdef TASK_EVENT_TRACE
525 enum { EVENT_DUMP_PAD = 1, EVENT_DUMP_HEX = 2 };
526 
527 struct task_event {
528  task_arg arg;
529  int flag;
530 };
531 
532 typedef struct task_event task_event;
533 
534 void add_event(int flag, task_arg te);
535 void add_task_event(double when, char const *file, int state, char const *what);
536 void add_wait_event(double when, char const *file, int state, char const *what,
537  int milli);
538 void dump_task_events();
539 void reset_task_events();
540 #endif
541 
542 /* The current task */
543 extern task_env *stack;
544 
545 extern void *task_allocate(task_env *p, unsigned int bytes);
546 extern void reset_state(task_env *p);
547 extern void pushp(task_env *p, void *ptr);
548 extern void popp(task_env *p);
549 
550 extern double seconds(); /* Return time as double */
551 extern double task_now(); /* Return result of last call to seconds() */
552 extern void task_delay_until(double time);
553 
554 extern int unblock_fd(int fd);
555 extern int block_fd(int fd);
556 extern int connect_tcp(char *server, xcom_port port, int *ret);
558 extern int accept_tcp(int fd, int *ret);
559 
560 extern int task_read(connection_descriptor const *con, void *buf, int n,
561  int64_t *ret);
562 extern int task_write(connection_descriptor const *con, void *buf, uint32_t n,
563  int64_t *ret);
564 extern int is_locked(int fd);
565 extern int lock_fd(int fd, task_env *t, int lock);
566 extern int unlock_fd(int fd, task_env *t, int lock);
567 
568 extern void task_sys_init();
569 extern task_env *task_new(task_func func, task_arg arg, const char *name,
570  int debug);
571 #define xstr(s) #s
572 /* #define task_new(func, arg) _task_new(func, arg, __FILE__":" xstr(__LINE__))
573  */
574 extern void task_loop();
575 extern void task_wait(task_env *t, linkage *queue);
576 extern void task_wakeup(linkage *queue);
577 extern task_env *task_terminate(task_env *t);
578 extern void set_task(task_env **p, task_env *t);
579 extern void task_terminate_all();
580 extern void remove_and_wakeup(int i);
581 extern int task_errno;
582 extern int is_only_task();
583 extern task_env *task_activate(task_env *t);
584 extern task_env *task_deactivate(task_env *t);
585 extern const char *task_name();
586 extern task_env *wait_io(task_env *t, int fd, int op);
587 
588 extern result con_read(connection_descriptor const *rfd, void *buf, int n);
589 extern result con_write(connection_descriptor const *wfd, void *buf, int n);
590 extern result set_nodelay(int fd);
591 
592 extern xcom_proto const my_min_xcom_version; /* The minimum protocol version I
593  am able to understand */
594 extern xcom_proto const
595  my_xcom_version; /* The maximum protocol version I am able to understand */
596 
597 /* Use SSL ? */
598 void xcom_enable_ssl();
599 void xcom_disable_ssl();
600 
601 #endif
Definition: result.h:29
void xcom_disable_ssl()
void * v
Definition: task_arg.h:52
channel * channel_init(channel *c, unsigned int type)
Definition: task.cc:579
void * ptr
Definition: task.h:215
Definition: task_arg.h:41
static void * get_void_arg(task_arg arg)
Definition: task.h:159
arg_type type
Definition: task_arg.h:42
void channel_put_front(channel *c, linkage *data)
Definition: task.cc:591
int is_only_task()
Definition: task.cc:1089
task_env * stack
Definition: task.cc:867
static long get_long_arg(task_arg arg)
Definition: task.h:89
static void set_double_arg(task_arg *arg, double value)
Definition: task.h:134
static task_arg uint_arg(unsigned int i)
Definition: task.h:170
int block_fd(int fd)
Definition: task.cc:1070
result con_read(connection_descriptor const *rfd, void *buf, int n)
Definition: task.cc:889
Definition: task.h:230
terminate_enum terminate
Definition: task.h:247
task_env * task_new(task_func func, task_arg arg, const char *name, int debug)
Definition: task.cc:597
Definition: task_arg.h:31
static char const * get_string_arg(task_arg arg)
Definition: task.h:154
static void set_long_arg(task_arg *arg, long value)
Definition: task.h:84
static void set_ulong_long_arg(task_arg *arg, unsigned long long value)
Definition: task.h:109
linkage l
Definition: task.h:242
TaskAlign * stack_top
Definition: task.h:254
static task_arg void_arg(void *v)
Definition: task.h:200
const char * name
Definition: task.h:252
xcom_proto const my_xcom_version
Definition: xcom_transport.cc:80
void task_sys_init()
Definition: task.cc:1594
static task_arg ulong_long_arg(unsigned long long ll)
Definition: task.h:182
static QUEUE queue
Definition: myisampack.cc:206
linkage queue
Definition: task.h:439
terminate_enum
Definition: task.h:229
double task_now()
Definition: task.cc:309
int curn
Definition: task.h:269
Definition: task_arg.h:34
void pushp(task_env *p, void *ptr)
Definition: task.cc:645
linkage all
Definition: task.h:243
Definition: task.h:437
static task_arg double_arg(double i)
Definition: task.h:188
long l
Definition: task_arg.h:45
static void set_float_arg(task_arg *arg, float value)
Definition: task.h:124
#define TASK_POOL_ELEMS
Definition: task.h:227
Definition: task.h:231
char const * s
Definition: task_arg.h:51
static float get_float_arg(task_arg arg)
Definition: task.h:129
#define MAXTASKS
Definition: task.h:265
int is_locked(int fd)
unsigned short xcom_port
Definition: xcom_common.h:45
int waitfd
Definition: task.h:259
Definition: task_arg.h:29
static task_arg ulong_arg(unsigned long l)
Definition: task.h:176
int state
Definition: task.h:214
static unsigned long get_ulong_arg(task_arg arg)
Definition: task.h:114
static in_port_t port
Definition: testapp.c:33
result set_nodelay(int fd)
Definition: task.cc:1308
void * task_allocate(task_env *p, unsigned int bytes)
Allocate bytes from pool, initialized to zero.
Definition: task.cc:618
void xcom_enable_ssl()
task_env * task_deactivate(task_env *t)
Definition: task.cc:707
int taskret
Definition: task.h:249
void task_wait(task_env *t, linkage *queue)
Definition: task.cc:552
Definition: simset.h:35
static std::mutex lock
Definition: net_ns.cc:55
static void set_int_arg(task_arg *arg, int value)
Definition: task.h:74
double d
Definition: task_arg.h:50
Definition: node_connection.h:44
union task_arg::@12 val
Header for compiler-dependent features.
TaskAlign * where
Definition: task.h:253
task_env * wait_io(task_env *t, int fd, int op)
Definition: task.cc:869
case opt name
Definition: sslopt-case.h:32
task_env * task_terminate(task_env *t)
Definition: task.cc:710
Definition: server_struct.h:38
int debug
Definition: task.h:258
linkage data
Definition: task.h:438
static unsigned int get_uint_arg(task_arg arg)
Definition: task.h:99
result con_write(connection_descriptor const *wfd, void *buf, int n)
Definition: task.cc:962
static task_arg int_arg(int i)
Definition: task.h:164
TaskAlign * sp
Definition: task.h:255
static void set_void_arg(task_arg *arg, void *value)
Definition: task.h:149
static double get_double_arg(task_arg arg)
Definition: task.h:139
const char * task_name()
Definition: task.cc:1616
static task_arg string_arg(char const *v)
Definition: task.h:194
Definition: task_arg.h:30
Definition: task_arg.h:33
int connect_tcp(char *server, xcom_port port, int *ret)
Definition: task.cc:1191
double time
Definition: task.h:256
static void set_uint_arg(task_arg *arg, unsigned int value)
Definition: task.h:94
int unblock_fd(int fd)
Definition: task.cc:1052
double seconds()
Definition: task.cc:301
static int flag
Definition: hp_test1.cc:39
int interrupt
Definition: task.h:260
void reset_state(task_env *p)
Definition: task.cc:636
Definition: task_arg.h:32
Definition: task.h:268
unsigned long long u_ll
Definition: task_arg.h:48
void channel_put(channel *c, linkage *data)
Definition: task.cc:585
task_env * task_activate(task_env *t)
Definition: task.cc:705
int lock_fd(int fd, task_env *t, int lock)
Definition: task_arg.h:35
int i
Definition: task_arg.h:44
int n
Definition: xcom_base.cc:442
void popp(task_env *p)
Definition: task.cc:656
result announce_tcp(xcom_port port)
Definition: task.cc:1435
void task_delay_until(double time)
Definition: task.cc:544
task_func func
Definition: task.h:250
Definition: task_arg.h:36
static char * add_event(const char *var, LEX_CSTRING event, const char *data, size_t data_length)
Definition: audit_null.cc:301
unsigned int u_i
Definition: task_arg.h:46
task_arg arg
Definition: task.h:251
int refcnt
Definition: task.h:248
xcom_proto const my_min_xcom_version
Definition: xcom_transport.cc:78
Definition: task_arg.h:37
Definition: os0file.h:85
const char * p
Definition: ctype-mb.cc:1235
Definition: task.h:213
static unsigned long long get_ulong_long_arg(task_arg arg)
Definition: task.h:119
const string value("\alue\)
Definition: task_arg.h:28
int(* task_func)(task_arg arg)
Definition: task.h:223
static task_arg end_arg()
Definition: task.h:206
int task_write(connection_descriptor const *con, void *buf, uint32_t n, int64_t *ret)
Definition: task.cc:998
void task_terminate_all()
Definition: task.cc:723
float f
Definition: task_arg.h:49
static int get_int_arg(task_arg arg)
Definition: task.h:79
void task_loop()
Definition: task.cc:1109
int unlock_fd(int fd, task_env *t, int lock)
int task_errno
Definition: task.cc:125
int accept_tcp(int fd, int *ret)
Definition: task.cc:1515
Definition: task.h:232
void task_wakeup(linkage *queue)
Definition: task.cc:560
int task_read(connection_descriptor const *con, void *buf, int n, int64_t *ret)
Definition: task.cc:922
static void set_ulong_arg(task_arg *arg, unsigned long value)
Definition: task.h:104
void remove_and_wakeup(int i)
Definition: task.cc:855
unsigned long u_l
Definition: task_arg.h:47
int heap_pos
Definition: task.h:244
void set_task(task_env **p, task_env *t)
Definition: task.cc:1610
static void set_string_arg(task_arg *arg, char const *value)
Definition: task.h:144
Definition: task.h:241