Skip to content

File syn_task.h

FileList > sched > syn_task.h

Go to the source code of this file

Task descriptor for the cooperative scheduler. More...

  • #include "../pt/syn_pt.h"
  • #include <stdint.h>
  • #include "syn_event_flags.h"

Classes

Type Name
struct SYN_Task
Task descriptor — binds a protothread to scheduler metadata.

Public Types

Type Name
typedef SYN_PT_Status(* SYN_TaskFunc
Protothread task function.
enum SYN_TaskState
Cooperative task lifecycle state.

Detailed Description

Defines the task control block (SYN_Task) that pairs a protothread with scheduling metadata: priority, state, name, delay target, and optional event-wait fields for true blocking.

Tasks are caller-owned — you allocate them however you like (static array, global, on the stack). The scheduler just takes a pointer to your array.

Public Types Documentation

typedef SYN_TaskFunc

Protothread task function.

typedef SYN_PT_Status(* SYN_TaskFunc) (SYN_PT *pt, struct SYN_Task *task);

A task function receives its own protothread and task descriptor. It must follow the PT_BEGIN / PT_END pattern.

Parameters:

  • pt Pointer to the task's protothread (same as &task->pt).
  • task Pointer to the task descriptor (for user_data, delay, etc.).

Returns:

PT status indicating whether the thread yielded, is waiting, or exited.


enum SYN_TaskState

Cooperative task lifecycle state.

enum SYN_TaskState {
    SYN_TASK_READY = 0,
    SYN_TASK_SUSPENDED = 1,
    SYN_TASK_DEAD = 2,
    SYN_TASK_DEFERRED = 3,
    SYN_TASK_BLOCKED = 4,
    SYN_TASK_WAITING = 5
};



The documentation for this class was generated from the following file src/syntropic/sched/syn_task.h