]> git.proxmox.com Git - mirror_frr.git/commit - lib/event.c
lib: allow pthreads to poke poll()
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 10 May 2017 18:09:49 +0000 (18:09 +0000)
committerQuentin Young <qlyoung@users.noreply.github.com>
Tue, 30 May 2017 14:27:10 +0000 (10:27 -0400)
commit3bf2673b3094727edee168f4b5a93095420f6b23
treebd505c40d36993ff6acab398ac3ef36f86cf887f
parent75bcb3558d25b8ca7d3383f5c2c648d0aceae103
lib: allow pthreads to poke poll()

When scheduling a task onto a thread master owned by another pthread, we
need to lock the thread master's mutex. However, if the pthread which
owns that thread master is in poll(), we could be stuck waiting for a
very long time. To solve this, we copy all data poll() needs and unlock
during poll(). To break the target pthread out of poll(), thread_master
has gained a pipe whose reading end is passed into poll(). After an event
that requires immediate action by the target pthread, a byte is written
into the pipe in order to wake it up.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
[DL: split off from select() removal]
lib/thread.c
lib/thread.h