medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e45fd2b66e9623cdf6b934bd6312ca6cb815d197
parent 6c1edccefd47e715a8367bd6f26f52f0768ea122
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue Dec  6 21:44:38 +0200

Automatically clear the worker thread memory arenas

Diffstat:
work_queue.cc | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/work_queue.cc b/work_queue.cc @@ -21,7 +21,10 @@ static bool workqueue_step( u32 thread_id, WorkQueue * queue ) { if( current_head != load_acquire( &queue->tail ) ) { if( compare_exchange_acqrel( &queue->head, &current_head, new_head ) ) { const Job & job = queue->jobs[ current_head % ARRAY_COUNT( queue->jobs ) ]; - job.callback( job.data, &queue->arenas[ thread_id ] ); + MemoryArena * arena = &queue->arenas[ thread_id ]; + + memarena_clear( arena ); + job.callback( job.data, arena ); } return true;