![]() |
MySQL 8.0.40
Source Code Documentation
|
Rudimentary, non-preemptive task system in portable C, based on Tom Duff's switch-based coroutine trick and a stack of environment structs. More...
#include "xcom/x_platform.h"
#include "xcom/xcom_memory.h"
#include "xcom/xcom_profile.h"
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <limits.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <memory>
#include "xcom/node_connection.h"
#include "xdr_gen/xcom_vp.h"
#include "xcom/simset.h"
#include "xcom/site_def.h"
#include "xcom/task.h"
#include "xcom/task_debug.h"
#include "xcom/task_net.h"
#include "xcom/task_os.h"
#include "xcom/xcom_base.h"
#include "xcom/xcom_cfg.h"
#include "xcom/xcom_transport.h"
#include <poll.h>
#include "xcom/retry.h"
#include "xcom/xdr_utils.h"
Classes | |
struct | pollfd_array |
struct | task_env_p_array |
struct | xcom_clock |
Macros | |
#define | xcom_buf void |
#define | crash(x) g_critical("%s\n", x) |
#define | FIX_POS(i) q->x[i]->heap_pos = (i) |
#define | TASK_SWAP(i, j) |
#define | TASK_MOVE(i, j) |
#define | STAT_INTERVAL 1.0 |
Typedefs | |
typedef struct iotasks | iotasks |
typedef task_env * | task_env_p |
typedef struct xcom_clock | xcom_clock |
Variables | |
task_arg | null_arg = {a_end, {0}} |
int | task_errno = 0 |
static xcom_clock | task_timer |
static linkage | ash_nazg_gimbatul |
static linkage | tasks = {0, &tasks, &tasks} |
static task_queue | task_time_q |
static linkage | free_tasks = {0, &free_tasks, &free_tasks} |
static int | active_tasks = 0 |
static iotasks | iot |
task_env * | stack = nullptr |
static uint64_t | send_count |
static uint64_t | receive_count |
static uint64_t | send_bytes |
static uint64_t | receive_bytes |
static should_exit_getter | get_should_exit |
static double | idle_time = 0.0 |
Rudimentary, non-preemptive task system in portable C, based on Tom Duff's switch-based coroutine trick and a stack of environment structs.
(continuations?) Nonblocking IO and event handling need to be rewritten for each new OS. The code is not MT-safe, but could be made safe by moving all global variables into a context struct which could be the first parameter to all the functions.
#define crash | ( | x | ) | g_critical("%s\n", x) |
#define FIX_POS | ( | i | ) | q->x[i]->heap_pos = (i) |
#define STAT_INTERVAL 1.0 |
#define TASK_MOVE | ( | i, | |
j | |||
) |
#define TASK_SWAP | ( | i, | |
j | |||
) |
#define xcom_buf void |
typedef task_env* task_env_p |
typedef struct xcom_clock xcom_clock |
|
static |
int block_fd | ( | int | fd | ) |
result con_pipe_read | ( | connection_descriptor const * | rfd, |
void * | buf, | ||
int | n | ||
) |
result con_pipe_write | ( | connection_descriptor const * | wfd, |
void * | buf, | ||
int | n | ||
) |
result con_read | ( | connection_descriptor const * | rfd, |
void * | buf, | ||
int | n | ||
) |
result con_write | ( | connection_descriptor const * | wfd, |
void * | buf, | ||
int | n | ||
) |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
uint32_t get_my_xcom_id | ( | ) |
|
inlinestatic |
|
static |
init_xdr_array | ( | pollfd | ) |
|
static |
|
static |
int is_only_task | ( | ) |
|
static |
|
static |
const char * pax_op_to_str | ( | int | x | ) |
|
static |
|
static |
void popp | ( | task_env * | p | ) |
void pushp | ( | task_env * | p, |
void * | ptr | ||
) |
void remove_and_wakeup | ( | int | fd | ) |
void reset_state | ( | task_env * | p | ) |
|
static |
double seconds | ( | ) |
void set_should_exit_getter | ( | should_exit_getter | x | ) |
void * task_allocate | ( | task_env * | p, |
unsigned int | bytes | ||
) |
Allocate bytes from pool, initialized to zero.
void task_delay_until | ( | double | time | ) |
|
static |
|
static |
Initialize task memory.
void task_loop | ( | ) |
const char * task_name | ( | ) |
double task_now | ( | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
int task_read | ( | connection_descriptor const * | con, |
void * | buf, | ||
int | n, | ||
int64_t * | ret, | ||
connnection_read_method | read_function | ||
) |
|
static |
void task_sys_init | ( | ) |
void task_terminate_all | ( | ) |
void task_wakeup | ( | linkage * | queue | ) |
|
static |
int task_write | ( | connection_descriptor const * | con, |
void * | _buf, | ||
uint32_t | n, | ||
int64_t * | ret | ||
) |
|
inlinestatic |
int unblock_fd | ( | int | fd | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
int task_errno = 0 |
|
static |
|
static |
|
static |