Browse Source

MT#55524 use define for thread sleep time

Keep the maximum time for a thread to sleep in a central place

Change-Id: Id4445f40d34648a2efbcbf17d67f2921c7dedf46
pull/1577/head
Richard Fuchs 3 years ago
parent
commit
0c4fc1c31d
3 changed files with 4 additions and 3 deletions
  1. +2
    -2
      daemon/main.c
  2. +1
    -1
      daemon/poller.c
  3. +1
    -0
      include/aux.h

+ 2
- 2
daemon/main.c View File

@ -115,8 +115,8 @@ static void sighandler(gpointer x) {
sigaddset(&ss, SIGUSR1);
sigaddset(&ss, SIGUSR2);
ts.tv_sec = 10;
ts.tv_nsec = 0;
ts.tv_sec = thread_sleep_time / 1000;
ts.tv_nsec = (thread_sleep_time % 1000) * 1000 * 1000;
while (!rtpe_shutdown) {
thread_cancel_enable();


+ 1
- 1
daemon/poller.c View File

@ -616,7 +616,7 @@ void poller_loop2(void *d) {
struct poller *p = d;
while (!rtpe_shutdown) {
int ret = poller_poll(p, 10000);
int ret = poller_poll(p, thread_sleep_time);
if (ret < 0)
usleep(20 * 1000);
}


+ 1
- 0
include/aux.h View File

@ -351,6 +351,7 @@ INLINE void thread_create_detach(void (*f)(void *), void *a, const char *name) {
#define thread_cancel_enable() pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)
#define thread_cancel_disable() pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL)
#define thread_sleep_time 10000 /* ms */


Loading…
Cancel
Save