typedef struct task_node { void *arg; /* fun arg. */ void *(*fun) (void *); /* the real work of the task. */ pthread_t tid; /* which thread exec this task. */ int work_id; /* task id. */ int flag; /* 1: assigned, 0: unassigned. */ struct task_node *n…