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
@@ -119,6 +119,11 @@ int message_get(message_queue_t *queue, void **data, int *priority) {
return size;
}
void message_get_unlock(message_queue_t *queue) {
/* don't do anything, this function exists to unlock a message_queue but is
* not needed in the case of the ringbuffer_queue */
}
void destroy_message_queue(message_queue_t *queue) {
struct lfds700_misc_prng_state ls;