removed some exiting checks
This commit is contained in:
parent
9a4b63093b
commit
3421533b73
@ -58,7 +58,7 @@ inline bdd_io_id bdd_n_ev(struct bdd_conversation *conversation) {
|
||||
struct bdd_conversation *bdd_conversation_obtain(int epoll_fd) {
|
||||
struct bdd_conversation *conversation;
|
||||
pthread_mutex_lock(&(bdd_gv.available_conversations.mutex));
|
||||
if (atomic_load(&(bdd_gv.exiting)) || bdd_gv.available_conversations.idx == bdd_gv.n_conversations) {
|
||||
if (bdd_gv.available_conversations.idx == bdd_gv.n_conversations) {
|
||||
pthread_mutex_unlock(&(bdd_gv.available_conversations.mutex));
|
||||
return NULL;
|
||||
}
|
||||
@ -116,34 +116,32 @@ void bdd_conversation_discard(struct bdd_conversation *conversation) {
|
||||
BDD_CONVERSATION_AGE_MS(conversation, "d");
|
||||
conversation->state = bdd_conversation_unused;
|
||||
|
||||
if (!atomic_load(&(bdd_gv.exiting))) {
|
||||
pthread_mutex_lock(&(bdd_gv.available_conversations.mutex));
|
||||
pthread_mutex_lock(&(bdd_gv.available_conversations.mutex));
|
||||
|
||||
assert(bdd_gv.available_conversations.idx != 0);
|
||||
assert(bdd_gv.available_conversations.idx != 0);
|
||||
|
||||
int id = bdd_conversation_id(conversation);
|
||||
int id = bdd_conversation_id(conversation);
|
||||
|
||||
assert(id >= 0 && id < bdd_gv.n_conversations);
|
||||
assert(id >= 0 && id < bdd_gv.n_conversations);
|
||||
|
||||
bool made_avail = bdd_gv.available_conversations.idx == bdd_gv.n_conversations;
|
||||
bool made_avail = bdd_gv.available_conversations.idx == bdd_gv.n_conversations;
|
||||
|
||||
bdd_gv.available_conversations.ids[--(bdd_gv.available_conversations.idx)] = id;
|
||||
bdd_gv.available_conversations.ids[--(bdd_gv.available_conversations.idx)] = id;
|
||||
|
||||
if (made_avail) {
|
||||
for (size_t idx = 0; idx < bdd_gv.n_workers; ++idx) {
|
||||
struct bdd_worker_data *worker_data = bdd_gv_worker(idx);
|
||||
struct epoll_event ev = {
|
||||
.events = EPOLLIN,
|
||||
.data = { .ptr = NULL, },
|
||||
};
|
||||
if (epoll_ctl(worker_data->epoll_fd, EPOLL_CTL_MOD, worker_data->serve_fd, &(ev)) != 0) {
|
||||
abort();
|
||||
}
|
||||
if (made_avail) {
|
||||
for (size_t idx = 0; idx < bdd_gv.n_workers; ++idx) {
|
||||
struct bdd_worker_data *worker_data = bdd_gv_worker(idx);
|
||||
struct epoll_event ev = {
|
||||
.events = EPOLLIN,
|
||||
.data = { .ptr = NULL, },
|
||||
};
|
||||
if (epoll_ctl(worker_data->epoll_fd, EPOLL_CTL_MOD, worker_data->serve_fd, &(ev)) != 0) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&(bdd_gv.available_conversations.mutex));
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&(bdd_gv.available_conversations.mutex));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user