medfall

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

commit 81dbe64d5d547dda46ea420ad8ec55511a2b3394
parent 6ce4002c37ed868e4b6026d4059e8815a12fbca9
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Wed Aug 12 19:20:21 +0200

Fix segfault in work_queue

Diffstat:
hm.cc | 2--
work_queue.cc | 6++----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/hm.cc b/hm.cc @@ -62,9 +62,7 @@ extern "C" GAME_INIT( game_init ) { nums[ i ] = i; workqueue_enqueue( &state->background_tasks, testwq, &nums[ i ] ); } - printf( "let's exhaust\n" ); workqueue_exhaust( &state->background_tasks ); - printf( "init done\n" ); glClearColor( 0, 0.5, 0.7, 1 ); } diff --git a/work_queue.cc b/work_queue.cc @@ -18,11 +18,9 @@ static bool workqueue_step( WorkQueue * const queue ) { // read_barrier(); TODO: - if( queue->jobs_completed < queue->jobs_queued ) { + if( current_head != queue->tail ) { if( __sync_bool_compare_and_swap( &queue->head, current_head, new_head ) ) { - printf( "let's do a step\n" ); - Job & job = queue->jobs[ current_head ]; - + const Job & job = queue->jobs[ current_head ]; job.callback( job.data ); __sync_fetch_and_add( &queue->jobs_completed, 1 );