File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -388,13 +388,13 @@ void queue_free(queue_t *q) {
388
388
}
389
389
390
390
void queue_push (queue_t * q , int type , void * data ) {
391
- pthread_mutex_lock (& q -> mutex );
392
-
393
391
queue_item_t * i = malloc (sizeof (queue_item_t ));
394
392
i -> type = type ;
395
393
i -> data = data ;
396
394
i -> next = NULL ;
397
395
396
+ pthread_mutex_lock (& q -> mutex );
397
+
398
398
if (q -> last ) {
399
399
q -> last -> next = i ;
400
400
} else {
@@ -415,12 +415,12 @@ int queue_pop(queue_t *q, void **datap) {
415
415
q -> first = i -> next ;
416
416
if (!q -> first )
417
417
q -> last = NULL ;
418
+ pthread_mutex_unlock (& q -> mutex );
418
419
419
420
* datap = i -> data ;
420
421
int type = i -> type ;
421
422
free (i );
422
423
423
- pthread_mutex_unlock (& q -> mutex );
424
424
return type ;
425
425
}
426
426
Original file line number Diff line number Diff line change @@ -536,7 +536,7 @@ static void read_thread(void) {
536
536
debug ("read: skip %llu" , iter .block .number_in_file );
537
537
continue ;
538
538
}
539
- for ( ; w && w -> end < uend ; w = w -> next ) ;
539
+ for ( ; w && w -> end <= uend ; w = w -> next ) ;
540
540
}
541
541
debug ("read: want %llu" , iter .block .number_in_file );
542
542
You can’t perform that action at this time.
0 commit comments