Thread save message queues.
More...
Typedefs |
typedef struct bg_msg_queue_s | bg_msg_queue_t |
| Opaque message queue type. You don't want to know what's inside.
|
Detailed Description
Thread save message queues.
Typedef Documentation
Opaque message queue type. You don't want to know what's inside.
Function Documentation
Create a message queue.
- Returns:
- A newly allocated message queue
Destroy a message queue.
- Parameters:
-
Lock a message queue for reading.
- Parameters:
-
- Returns:
- A new message or NULL
This function blocks until a message arrives and returns the message. Use this function with caution to avoid deadlocks.
When you are done with the message, call bg_msg_queue_unlock_read. The message is owned by the queue and must not be freed.
Try to lock a message queue for reading.
- Parameters:
-
- Returns:
- A new message or NULL
This function immediately returns NULL if there is no message for reading. When you are done with the message, call bg_msg_queue_unlock_read. The message is owned by the queue and must not be freed.
Unlock a message queue for reading.
- Parameters:
-
Call this to signal, that you are done with a message.
Lock a message queue for writing.
- Parameters:
-
- Returns:
- An empty message, where you can place your information.
When you are done setting the ID and arguments, call bg_msg_queue_unlock_write.
Unlock a message queue for writing.
- Parameters:
-
Call this to signal, that you are done with a message.
Check, if there is a message for readinbg available and get the ID.
- Parameters:
-
mq | A message queue |
id | Might return the ID |
- Returns:
- 1 if there is a message (and id is valid), 0 else