![]() |
EM-ODP 4.4.0
Event Machine on ODP
|
Functions | |
| em_atomic_group_t | em_atomic_group_create (const char *name, em_queue_group_t queue_group) |
| em_status_t | em_atomic_group_delete (em_atomic_group_t atomic_group) |
| em_queue_t | em_queue_create_ag (const char *name, em_queue_prio_t prio, em_atomic_group_t atomic_group, const em_queue_conf_t *conf) |
| em_status_t | em_queue_create_static_ag (const char *name, em_queue_prio_t prio, em_atomic_group_t atomic_group, em_queue_t queue, const em_queue_conf_t *conf) |
| size_t | em_atomic_group_name (em_atomic_group_t atomic_group, char *name, size_t maxlen) |
| em_atomic_group_t | em_atomic_group_find (const char *name) |
| em_atomic_group_t | em_atomic_group_first (unsigned int *num) |
| em_atomic_group_t | em_atomic_group_next (void) |
| em_queue_t | em_atomic_group_queue_first (unsigned int *num, em_atomic_group_t atomic_group) |
| em_queue_t | em_atomic_group_queue_next (void) |
| uint64_t | em_atomic_group_to_u64 (em_atomic_group_t atomic_group) |
Event Machine atomic queue group (new to API 1.1)
An atomic group combines multiple atomic queues in such a way that only one event from any of the included queues can be scheduled to the application at any one time, effectively scheduling several queues like a single atomic one. The main use case is to provide a protected race free context by atomic scheduling but allow multiple priorities (all of the queue contexts for queues in one atomic group are protected. The related EO context is also protected, if all queues of that EO are in one atomic group only, thus effectively creating an atomic EO).
All queues in an atomic group belong to the same queue group given when creating a new atomic group. Queues for an atomic group must be created using _ag - functions, but can be deleted normally using em_queue_delete().
| #define em_atomic_group_get_first em_atomic_group_first |
Definition at line 220 of file event_machine_atomic_group.h.
| #define em_atomic_group_get_name em_atomic_group_name |
Definition at line 173 of file event_machine_atomic_group.h.
| #define em_atomic_group_get_next em_atomic_group_next |
Definition at line 236 of file event_machine_atomic_group.h.
| #define em_atomic_group_queue_get_first em_atomic_group_queue_first |
Definition at line 278 of file event_machine_atomic_group.h.
| #define em_atomic_group_queue_get_next em_atomic_group_queue_next |
Definition at line 294 of file event_machine_atomic_group.h.
| em_atomic_group_t em_atomic_group_create | ( | const char * | name, |
| em_queue_group_t | queue_group | ||
| ) |
Create a new atomic group
Some systems may have a limited number of atomic groups available or a limited number of queues per atomic group.
The given name string is copied into an EM internal data structure. The maximum string length is EM_ATOMIC_GROUP_NAME_LEN. Duplicate names are allowed, but find will only match one of them.
| name | Atomic group name (optional, NULL ok) |
| queue_group | Existing queue group to use for this atomic group |
Definition at line 68 of file event_machine_atomic_group.c.
| em_status_t em_atomic_group_delete | ( | em_atomic_group_t | atomic_group | ) |
Delete an atomic group.
| atomic_group | Atomic group to delete |
Definition at line 214 of file event_machine_atomic_group.c.
| em_atomic_group_t em_atomic_group_find | ( | const char * | name | ) |
Find atomic group by name.
Finds an atomic group by the given name (exact match). An empty string will not match anything. The search is case sensitive. If there are duplicate names, this will return the first match only.
| name | the name to look for |
Definition at line 397 of file event_machine_atomic_group.c.
| em_atomic_group_t em_atomic_group_first | ( | unsigned int * | num | ) |
Initialize atomic group iteration and return the first atomic group handle.
Can be used to initialize the iteration to retrieve all created atomic groups for debugging or management purposes. Use em_atomic_group_next() after this call until it returns EM_ATOMIC_GROUP_UNDEF. A new call to em_atomic_group_first() resets the iteration, which is maintained per core (thread). The operation should be completed in one go before returning from the EO's event receive function (or start/stop).
The number of atomic groups (output arg 'num') may not match the amount of atomic groups actually returned by iterating using em_atomic_group_next() if atomic groups are added or removed in parallel by another core. The order of the returned atomic group handles is undefined.
| [out] | num | Pointer to an unsigned int to store the amount of atomic groups into |
Definition at line 413 of file event_machine_atomic_group.c.
| size_t em_atomic_group_name | ( | em_atomic_group_t | atomic_group, |
| char * | name, | ||
| size_t | maxlen | ||
| ) |
Get the name of an atomic group.
A copy of the name string (up to 'maxlen' characters) is written to the user given buffer. The string is always null terminated, even if the given buffer length is less than the name length.
If the atomic group has no name, the function returns 0 and writes an empty string.
| atomic_group | Atomic group | |
| [out] | name | Destination buffer |
| maxlen | Maximum length (including the terminating '0') |
Definition at line 364 of file event_machine_atomic_group.c.
| em_atomic_group_t em_atomic_group_next | ( | void | ) |
Return the next atomic group handle.
Continues the atomic group iteration started by em_atomic_group_first() and returns the next atomic group handle.
Definition at line 441 of file event_machine_atomic_group.c.
| em_queue_t em_atomic_group_queue_first | ( | unsigned int * | num, |
| em_atomic_group_t | atomic_group | ||
| ) |
Initialize iteration of an atomic group's queues and return the first queue handle.
Can be used to initialize the iteration to retrieve all queues associated with the given atomic group for debugging or management purposes. Use em_atomic_group_queue_next() after this call until it returns EM_QUEUE_UNDEF. A new call to em_atomic_group_queue_first() resets the iteration, which is maintained per core (thread). The operation should be started and completed in one go before returning from the EO's event receive function (or start/stop).
The number of queues in the atomic group (output arg 'num') may not match the amount of queues actually returned by iterating using em_atomic_group_queue_next() if queues are added or removed in parallel by another core. The order of the returned queue handles is undefined.
Simplified example:
| [out] | num | Pointer to unsigned int to store the amount of queues into. |
| atomic_group | Atomic group handle |
Definition at line 463 of file event_machine_atomic_group.c.
| em_queue_t em_atomic_group_queue_next | ( | void | ) |
Return the atomic group's next queue handle.
Continues the queue iteration started by em_atomic_group_queue_first() and returns the next queue handle in the atomic group.
Definition at line 517 of file event_machine_atomic_group.c.
| uint64_t em_atomic_group_to_u64 | ( | em_atomic_group_t | atomic_group | ) |
Convert an atomic group handle to an unsigned integer
| atomic_group | atomic group handle to be converted |
Definition at line 542 of file event_machine_atomic_group.c.
| em_queue_t em_queue_create_ag | ( | const char * | name, |
| em_queue_prio_t | prio, | ||
| em_atomic_group_t | atomic_group, | ||
| const em_queue_conf_t * | conf | ||
| ) |
Create a new queue with a dynamic queue handle belonging to an atomic group.
Queues created with this are always of type EM_QUEUE_TYPE_ATOMIC.
The given name string is copied to EM internal data structure. The maximum string length is EM_QUEUE_NAME_LEN.
The 'conf' argument is optional and can be used to pass extra attributes (e.g. require non-blocking behaviour, if supported) to the system specific implementation.
| name | Queue name (optional, NULL ok) |
| prio | Queue priority |
| atomic_group | Existing atomic group for this queue |
| conf | Optional configuration data, NULL for defaults |
Definition at line 257 of file event_machine_atomic_group.c.
| em_status_t em_queue_create_static_ag | ( | const char * | name, |
| em_queue_prio_t | prio, | ||
| em_atomic_group_t | atomic_group, | ||
| em_queue_t | queue, | ||
| const em_queue_conf_t * | conf | ||
| ) |
Create a new queue with a static queue handle belonging to an atomic group.
Otherwise equivalent to em_queue_create_ag().
Note that the number of static queues is provided by the user through 'queue.num_static' in em-odp.conf at runtime. A valid static queue handle can be derived as follows:
The 'x' in above pseudocode must be in range 0 to 'queue.num_static' - 1.
| name | Queue name (optional, NULL ok) |
| prio | Queue priority |
| atomic_group | Existing atomic group for this queue |
| queue | Requested queue handle from the static range |
| conf | Optional configuration data, NULL for defaults |
Definition at line 309 of file event_machine_atomic_group.c.