MT#55524 use define for thread sleep time

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

Change-Id: Id4445f40d34648a2efbcbf17d67f2921c7dedf46
(cherry picked from commit 0c4fc1c31d)
mr10.5.3
Richard Fuchs 2 years ago
parent 0fa1342a98
commit 8fec5d353b

@ -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();

@ -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);
}

@ -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