µEvLoop
A fast and lightweight event loop aimed at embedded platforms in C99.
signal.h
Go to the documentation of this file.
1 
6 #ifndef UEL_SIGNAL_H
7 #define UEL_SIGNAL_H
8 
10 #include "uevloop/utils/closure.h"
11 #include "uevloop/utils/promise.h"
14 #include "uevloop/system/event.h"
15 
22 typedef uintptr_t uel_signal_t;
23 
27 typedef struct uel_event_listener *uel_signal_listener_t;
28 
39 typedef struct uel_signal_relay uel_signal_relay_t;
43  uel_llist_t *signal_vector;
46  uel_sysqueues_t *queues;
48  uel_syspools_t *pools;
50  uintptr_t width;
51 };
52 
63  uel_signal_relay_t *relay,
64  uel_syspools_t *pools,
65  uel_sysqueues_t *queues,
66  uel_llist_t *buffer,
67  uintptr_t width
68 );
69 
79  uel_signal_t signal,
80  uel_signal_relay_t *relay,
81  uel_closure_t *closure
82 );
83 
94  uel_signal_t signal,
95  uel_signal_relay_t *relay,
96  uel_closure_t *closure
97 );
98 
106 
115 void uel_signal_emit(uel_signal_t signal, uel_signal_relay_t *relay, void *params);
116 
126  uel_signal_t signal,
127  uel_signal_relay_t *relay,
128  uel_promise_t *promise
129 );
130 
140  uel_signal_t signal,
141  uel_signal_relay_t *relay,
142  uel_promise_t *promise
143 );
144 
145 #endif /* end of include guard: UEL_SIGNAL_H */
uel_signal_resolve_promise
uel_signal_listener_t uel_signal_resolve_promise(uel_signal_t signal, uel_signal_relay_t *relay, uel_promise_t *promise)
Attaches a non-repeating listener that resolves the provided promise upon emission.
uel_signal_emit
void uel_signal_emit(uel_signal_t signal, uel_signal_relay_t *relay, void *params)
Emits a signal at the supplied relay. Any closure listening to this signal will be asynchronously inv...
uel_signal_t
uintptr_t uel_signal_t
Definition: signal.h:22
uel_signal_reject_promise
uel_signal_listener_t uel_signal_reject_promise(uel_signal_t signal, uel_signal_relay_t *relay, uel_promise_t *promise)
Attaches a non-repeating listener that rejects the provided promise upon emission.
linked-list.h
Defines a simple implementation of linked lists and functions to manipulate it.
uel_signal_relay::pools
uel_syspools_t * pools
A quick reference to the system's internal pools.
Definition: signal.h:48
closure.h
Defines closures, objects that bind functions to creating and calling contexts.
uel_signal_relay::queues
uel_sysqueues_t * queues
Definition: signal.h:46
uel_signal_relay
Contains a signal vector and operates on in.
Definition: signal.h:40
event.h
Defines events and methods to configure events.
uel_signal_listen_once
uel_signal_listener_t uel_signal_listen_once(uel_signal_t signal, uel_signal_relay_t *relay, uel_closure_t *closure)
Attaches a listener closure to some signal at a particular relay. The listener closure will be invoke...
promise.h
Contains definitions for promise stores, promises and functions to manipulate them.
uel_signal_relay::signal_vector
uel_llist_t * signal_vector
Definition: signal.h:43
uel_signal_listen
uel_signal_listener_t uel_signal_listen(uel_signal_t signal, uel_signal_relay_t *relay, uel_closure_t *closure)
Attaches a listener closure to some signal at a particular relay.
system-queues.h
A container for the system's internal queues.
uel_signal_unlisten
void uel_signal_unlisten(uel_signal_listener_t listener)
Marks a signal listener as expired. When its corresponding signal is emitted, this listener's closure...
uel_signal_listener_t
struct uel_event_listener * uel_signal_listener_t
Defines a reference type suitable to manipulate the actual listener event's context.
Definition: signal.h:27
uel_signal_relay_init
void uel_signal_relay_init(uel_signal_relay_t *relay, uel_syspools_t *pools, uel_sysqueues_t *queues, uel_llist_t *buffer, uintptr_t width)
Initialises a signal relay.
uel_signal_relay::width
uintptr_t width
The number of signals registered at this relay.
Definition: signal.h:50
system-pools.h
A container for the system's internal pools.