I think I figured this out on my own, there posed an issue if a worker thread died. NGINX will automatically respawn a new one, and I need to make sure the event attaches to the new one. This code ended up working good.
// There is already an event owner set.
if(dosstop_shm->event_owner)
{
// Does the PID still exist?
for (s = 0; s < ngx_last_process; s++) {
if (ngx_processes[s].pid == dosstop_shm->event_owner && !ngx_processes[s].exited) {
ngx_shmtx_unlock(&shpool->mutex);
return NGX_OK;
}
}
}