SimGrid 3.7.1
Scalable simulation of distributed systems
|
Synchronized message exchanging queue. More...
Typedefs | |
typedef struct s_xbt_queue_ * | xbt_queue_t |
Queue data type (opaque type) | |
Functions | |
xbt_queue_t | xbt_queue_new (int capacity, unsigned long elm_size) |
Create a new message exchange queue. | |
void | xbt_queue_free (xbt_queue_t *queue) |
Destroy a message exchange queue. | |
unsigned long | xbt_queue_length (const xbt_queue_t queue) |
Get the queue size. | |
void | xbt_queue_push (xbt_queue_t queue, const void *src) |
Push something to the message exchange queue. | |
void | xbt_queue_pop (xbt_queue_t queue, void *const dst) |
Pop something from the message exchange queue. | |
void | xbt_queue_unshift (xbt_queue_t queue, const void *src) |
Unshift something to the message exchange queue. | |
void | xbt_queue_shift (xbt_queue_t queue, void *const dst) |
Shift something from the message exchange queue. | |
void | xbt_queue_push_timed (xbt_queue_t queue, const void *src, double delay) |
Push something to the message exchange queue, with a timeout. | |
void | xbt_queue_unshift_timed (xbt_queue_t queue, const void *src, double delay) |
Unshift something to the message exchange queue, with a timeout. | |
void | xbt_queue_shift_timed (xbt_queue_t queue, void *const dst, double delay) |
Shift something from the message exchange queue, with a timeout. | |
void | xbt_queue_pop_timed (xbt_queue_t queue, void *const dst, double delay) |
Pop something from the message exchange queue, with a timeout. |
Synchronized message exchanging queue.
These is the classical producer/consumer synchronization scheme, which all concurrent programmer recode one day or another.
The good thing of this implementation is that it works seamlessly in your universe. When using one of the classical simulation interface (such as MSG), it achieves the synchronization on top of the simulator. If you use instead the real life implementation comming with GRAS, it uses the synchronization of your OS (whatever could it be). The choice is done at link time.
For performance concerns, the content of queue must be homogeneous, just like dynars (see the Dynar: generic dynamic array section). Actually, queues use a dynar to store the data, and add the synchronization on top of it.
xbt_queue_t xbt_queue_new | ( | int | capacity, |
unsigned long | elm_size | ||
) |
Create a new message exchange queue.
capacity | the capacity of the queue. If non-nul, any attempt to push an item which would let the size of the queue over this number will be blocking until someone else pop some data |
elm_size | size of each element stored in it (see xbt_dynar_new) |
void xbt_queue_free | ( | xbt_queue_t * | queue | ) |
Destroy a message exchange queue.
Any remaining content is leaked.
void xbt_queue_push | ( | xbt_queue_t | queue, |
const void * | src | ||
) |
Push something to the message exchange queue.
This is blocking if the declared capacity is non-nul, and if this amount is reached.
void xbt_queue_pop | ( | xbt_queue_t | queue, |
void *const | dst | ||
) |
Pop something from the message exchange queue.
This is blocking if the queue is empty.
void xbt_queue_unshift | ( | xbt_queue_t | queue, |
const void * | src | ||
) |
Unshift something to the message exchange queue.
This is blocking if the declared capacity is non-nul, and if this amount is reached.
void xbt_queue_shift | ( | xbt_queue_t | queue, |
void *const | dst | ||
) |
Shift something from the message exchange queue.
This is blocking if the queue is empty.
void xbt_queue_push_timed | ( | xbt_queue_t | queue, |
const void * | src, | ||
double | delay | ||
) |
Push something to the message exchange queue, with a timeout.
void xbt_queue_unshift_timed | ( | xbt_queue_t | queue, |
const void * | src, | ||
double | delay | ||
) |
Unshift something to the message exchange queue, with a timeout.
void xbt_queue_shift_timed | ( | xbt_queue_t | queue, |
void *const | dst, | ||
double | delay | ||
) |
Shift something from the message exchange queue, with a timeout.
void xbt_queue_pop_timed | ( | xbt_queue_t | queue, |
void *const | dst, | ||
double | delay | ||
) |
Pop something from the message exchange queue, with a timeout.
Back to the main Simgrid Documentation page |
The version of SimGrid documented here is v3.7.1. Documentation of other versions can be found in their respective archive files (directory doc/html). |
Generated by ![]() |