]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Add pthread_yield
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 6 Jan 2018 16:48:11 +0000 (11:48 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 6 Jan 2018 19:08:30 +0000 (14:08 -0500)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/frr_pthread.c
lib/frr_pthread.h

index 8b23640fa40ecb0a13e25a2c942884c5a642e8d1..19dfbaf54bfe46d7011079b28bbb188e6b065edd 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <zebra.h>
 #include <pthread.h>
+#include <sched.h>
 
 #include "frr_pthread.h"
 #include "memory.h"
@@ -182,3 +183,8 @@ unsigned int frr_pthread_get_id()
 {
        return next_id++;
 }
+
+void frr_pthread_yield(void)
+{
+       (void)sched_yield();
+}
index 9dee5fcca4a35bc9517cdfec626b4240fd1c3d90..f6000340a70873a2390af5235fef3118862b2db0 100644 (file)
@@ -130,6 +130,9 @@ int frr_pthread_stop(unsigned int id, void **result);
 /* Stops all frr_pthread's. */
 void frr_pthread_stop_all(void);
 
+/* Yields the current thread of execution */
+void frr_pthread_yield(void);
+
 /* Returns a unique identifier for use with frr_pthread_new().
  *
  * Internally, this is an integer that increments after each call to this