Correctly stop link_manager sender and receiver threads

This changes the destroy_link_manager() function to:
* call a new function message_get_unlock() to unlock the sending thread from
  its blocking message_get()
* calls pthread_cancel() on the receiving thread, because this unlocks any
  blocking read from a file descriptor

The same message_get_unlock() function has been added ringbuffer_queue to keep
the interfaces the same (it does nothing, because ringbuffer_queue is
non-blocking).
This commit is contained in:
Robert Schmidt
2019-02-07 17:56:56 +01:00
parent 0643d6b561
commit beec74b01a
5 changed files with 29 additions and 8 deletions
@@ -48,6 +48,7 @@ typedef struct {
message_queue_t * new_message_queue(int size);
int message_put(message_queue_t *queue, void *data, int size, int priority);
int message_get(message_queue_t *queue, void **data, int *priority);
void message_get_unlock(message_queue_t *queue);
void destroy_message_queue(message_queue_t *queue);
#endif /* RINGBUFFER_QUEUE_H */