From 64777f5d87e5e6a1b58e555f1e15849746808400 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 12 Sep 2018 21:25:49 +0200 Subject: [PATCH] lib: remove unused frr_pthread_yield() OS-level yield is generally a bad and possibly dangerous idea. If the thread should be suspended, there should always be something to wait on, or it turns into busy waiting. And if it's "just giving something else the chance to run" - that's the kernel's job to determine, and the kernel will do so while considering priorities, cgroups, and whatnot. Let it do its job. Signed-off-by: David Lamparter --- lib/frr_pthread.c | 5 ----- lib/frr_pthread.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 6541437f55..c1ce57e24e 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -205,11 +205,6 @@ void frr_pthread_stop_all() pthread_mutex_unlock(&frr_pthread_list_mtx); } -void frr_pthread_yield(void) -{ - (void)sched_yield(); -} - /* * ---------------------------------------------------------------------------- * Default Event Loop diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index 2a41de6d47..b9e60511d5 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -210,9 +210,6 @@ int frr_pthread_stop(struct frr_pthread *fpt, void **result); /* Stops all frr_pthread's. */ void frr_pthread_stop_all(void); -/* Yields the current thread of execution */ -void frr_pthread_yield(void); - #ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK #define pthread_condattr_setclock(A, B) #endif -- 2.39.5