This is called from inside a thread as the @a start_event for that thread. It chains to the startup events for the appropriate thread group start events.
| 484 | // This is called from inside a thread as the @a start_event for that thread. It chains to the |
| 485 | // startup events for the appropriate thread group start events. |
| 486 | void |
| 487 | EventProcessor::initThreadState(EThread *t) |
| 488 | { |
| 489 | // Run all thread type initialization continuations that match the event types for this thread. |
| 490 | for (int i = 0; i < MAX_EVENT_TYPES; ++i) { |
| 491 | if (t->is_event_type(i)) { |
| 492 | // To avoid race conditions on the event in the spawn queue, create a local one to actually send. |
| 493 | // Use the spawn queue event as a read only model. |
| 494 | Event *nev = eventAllocator.alloc(); |
| 495 | for (Event *ev = thread_group[i]._spawnQueue.head; nullptr != ev; ev = ev->link.next) { |
| 496 | nev->init(ev->continuation, 0, 0); |
| 497 | nev->ethread = t; |
| 498 | nev->callback_event = ev->callback_event; |
| 499 | nev->mutex = ev->continuation->mutex; |
| 500 | nev->cookie = ev->cookie; |
| 501 | ev->continuation->handleEvent(ev->callback_event, nev); |
| 502 | } |
| 503 | nev->free(); |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | int |
| 509 | EventProcessor::start(int n_event_threads, size_t stacksize) |
no test coverage detected