]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: remove unused frr_pthread_yield()
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 12 Sep 2018 19:25:49 +0000 (21:25 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 19 Sep 2018 20:01:50 +0000 (22:01 +0200)
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 <equinox@diac24.net>
lib/frr_pthread.c
lib/frr_pthread.h

index 6541437f55a9c07efcb7518b81d0bd3c46ba05f9..c1ce57e24ea6e15051793b5e5097e2f8329e9220 100644 (file)
@@ -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
index 2a41de6d474c35a2cadaaa876358c57c3144ae47..b9e60511d56aa7e725593e87c8533bad699e1202 100644 (file)
@@ -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