]> git.proxmox.com Git - mirror_frr.git/commit - lib/thread.c
lib: add mt-safe thread_cancel
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 7 Jun 2017 20:34:09 +0000 (20:34 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 16 Jun 2017 19:56:58 +0000 (19:56 +0000)
commit63ccb9cb12b559be539bc406f1b9ffc5cb3ac16a
treed03f194f1437b5a656bb48ddb029e6f4c7322a8a
parent62e4232010330e515630399838288f6281d04de6
lib: add mt-safe thread_cancel

This patch implements an MT-safe version of thread_cancel() in
thread_cancel_async(). Behavior as follows:

* Cancellation requests are queued into a list

* Cancellation requests made from the same pthread as the thread_master
  owner are serviced immediately (thread_cancel())

* Cancellation requests made from a separate pthread are queued and the
  call blocks on a condition variable until the owning pthread services
  the request, at which point the condition variable is signaled and
  execution continues (thread_cancel_async())

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/thread.c
lib/thread.h