void *thread_wait(void *arg) { int inx; int lerr; bool senders_done; arg = arg; // touch senders_done = false; #ifdef USE_EVENT_REG proc_event_register(LREQ); proc_event_register(LDONE); #endif for (inx = 0; inx < loop / 5; inx++) { do { lerr = XWAIT(LREQ | LDONE, 10); TEST_CHK_WAITIGNORE(lerr); if (lerr == 0) { if ((thr_send == NULL) && (thr_send_brk == NULL)) { senders_done = true; break; } } } while (lerr == 0); if (senders_done) break; printf("wait-thread woke up\n"); } if (senders_done) printf("wait-thread senders done, inx=%d\n", inx); return NULL; }
void *client_thr(void *arg) { long id = SB_Thread::Sthr::self_id(); SB_Thread::Thread *thr = (SB_Thread::Thread *) arg; char *name = thr->get_name(); int clinx; sscanf(&name[1], "%d", &clinx); #ifdef USE_EVENT_REG proc_event_register(LDONE); #endif for (int inx = 0; inx < 5; inx++) client(clinx, name, id, inx); return NULL; }