This page contains a condensed version of the protothreads API. For the full version, please see the documentation.

void PT_INIT(struct pt *pt);
Initialize a protothread.

void PT_BEGIN(struct pt *pt);
Declare the start of a protothread inside the C function implementing the protothread.

void PT_WAIT_UNTIL(struct pt *pt, condition);
Block and wait until condition is true.

void PT_WAIT_WHILE(struct pt *pt, condition);
Block and wait while condition is true.

void PT_WAIT_THREAD(struct pt *pt, thread);
Block and wait until a child protothread completes.

void PT_SPAWN(struct pt *pt, struct pt *child, thread);
Spawn a child protothread and wait until it exits.

void PT_RESTART(struct pt *pt);
Restart the protothread.

void PT_EXIT(struct pt *pt);
Exit the protothread.

void PT_END(struct pt *pt);
Declare the end of a protothread.

int PT_SCHEDULE(protothread);
Schedule a protothread.

void PT_YIELD(struct pt *pt);
Yield from the current protothread.