File intracoro.h
Communication primitives between the coroutine and the scheduler.
Event sinks and sources are connected that is, event sources can update one or more event sinks.
Typedefs
-
typedef enum coro_signal CoroSignal
Types of signals that can be sent to the scheduler.
Each one encodes an expected behaviour.
-
typedef enum coro_event_sink_type CoroEventSinkType
-
typedef struct coro_event_sink CoroEventSink
-
typedef enum coro_event_source_type CoroEventSourceType
-
typedef struct coro_event_source CoroEventSource
Enums
-
enum coro_signal
Types of signals that can be sent to the scheduler.
Each one encodes an expected behaviour.
Values:
-
enumerator CORO_SIG_WAIT
Coroutine is waiting for a signal, this implies the sinks have been configured. coroutine should not be resumed until any of the signals are triggered.
-
enumerator CORO_SIG_NOTIFY
This is a basic yield. Scheduler should place this coroutine back into the list of coroutines to be scheduled, but update any blocked coroutines with the provided event. Implies the event_source is active.
-
enumerator CORO_SIG_NOTIFY_AND_WAIT
Combination of both notifying and also blocking. Implies both event sources and event sinks are valid.
-
enumerator CORO_SIG_NOTIFY_AND_DONE
Special indicator indicating the coroutine is done and should no longer be scheduled. Implies the event_source is active.
-
enumerator CORO_SIG_WAIT
-
enum coro_event_sink_type
Values:
-
enumerator CORO_EVTSINK_NONE
Disabled event.
-
enumerator CORO_EVTSINK_DELAY
Coroutine is waiting for a time delay before it can resume.
-
enumerator CORO_EVTSINK_QUEUE_NOT_FULL
Coroutine is waiting on a queue to have an item. Uses the queue parameter.
-
enumerator CORO_EVTSINK_QUEUE_NOT_EMPTY
Coroutine is waiting on a queue to have space. Uses the queue parameter.
-
enumerator CORO_EVTSINK_EVENT_GET
Coroutine is waiting on an event. Uses the event parameter.
-
enumerator CORO_EVTSINK_SEMAPHORE_ACQUIRE
Coroutine is waiting on a semaphore to have space.
-
enumerator CORO_EVTSINK_MUTEX_ACQUIRE
Coroutine is waiting on a mutex to be released.
-
enumerator CORO_EVTSINK_WAIT_FINISH
Coroutine is waiting on another coroutine to finish.
-
enumerator CORO_EVTSINK_STREAM_NOT_FULL
Coroutine is waiting for the stream to free up.
-
enumerator CORO_EVTSINK_STREAM_NOT_EMPTY
Coroutine is waiting for the stream to have some bytes.
-
enumerator CORO_EVTSINK_NONE
-
enum coro_event_source_type
Values:
-
enumerator CORO_EVTSRC_NOOP
No special event.
-
enumerator CORO_EVTSRC_ELAPSED
Indicates that an elapsed period of time has passed.
-
enumerator CORO_EVTSRC_QUEUE_PUT
Indicates a queue has had an item put in it, coroutines waiting should unblock. Uses the queue parameter.
-
enumerator CORO_EVTSRC_QUEUE_GET
Indicates a queue has had an item removed from it, coroutines waiting should unblock. Uses the queue parameter.
-
enumerator CORO_EVTSRC_EVENT_SET
An event has one of its field set.
-
enumerator CORO_EVTSRC_SEMAPHORE_RELEASE
A semaphore has been released.
-
enumerator CORO_EVTSRC_MUTEX_RELEASE
A mutex has been released.
-
enumerator CORO_EVTSRC_CORO_FINISHED
Coroutine has finished.
-
enumerator CORO_EVTSRC_STREAM_RECV
Indicate the consumer has read some bytes from the stream.
-
enumerator CORO_EVTSRC_STREAM_SEND
Indicates the producer has written some bytes to the stream.
-
enumerator CORO_EVTSRC_NOOP
-
struct coro_event_sink
Public Members
-
CoroEventSinkType type
-
PlatformTick ticks_remaining
-
void *subject
-
union coro_event_sink params
-
CoroEventSinkType type
-
struct coro_event_source
Public Members
-
CoroEventSourceType type
-
PlatformTick elapsed_ticks
-
void *subject
-
union coro_event_source params
-
CoroEventSourceType type