Skip to content

Commit dc40a13

Browse files
committed
packetpool: signal waiter within lock
Needed for predictable scheduling. From pthread_cond_signal man page: "The pthread_cond_signal() or pthread_cond_broadcast() functions may be called by a thread whether or not it currently owns the mutex that threads calling pthread_cond_wait() or pthread_cond_timedwait() have associated with the condition variable during their waits; however, if predictable scheduling behaviour is required, then that mutex is locked by the thread calling pthread_cond_signal() or pthread_cond_broadcast()."
1 parent 087ca49 commit dc40a13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tmqh-packetpool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ void PacketPoolReturnPacket(Packet *p)
193193
my_pool->pending_tail->next = pool->return_stack.head;
194194
pool->return_stack.head = my_pool->pending_head;
195195
SC_ATOMIC_RESET(pool->return_stack.sync_now);
196-
SCMutexUnlock(&pool->return_stack.mutex);
197196
SCCondSignal(&pool->return_stack.cond);
197+
SCMutexUnlock(&pool->return_stack.mutex);
198198
/* Clear the list of pending packets to return. */
199199
my_pool->pending_pool = NULL;
200200
my_pool->pending_head = NULL;

0 commit comments

Comments
 (0)