Skip to content

Commit 6b15342

Browse files
committed
fix pthread initalization of mutexes
1 parent 768872e commit 6b15342

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

include/mimalloc/atomic.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,13 @@ static inline void mi_lock_release(mi_lock_t* lock) {
441441
pthread_mutex_unlock(lock);
442442
}
443443
static inline void mi_lock_init(mi_lock_t* lock) {
444-
(void)(lock);
444+
pthread_mutex_init(lock, NULL);
445445
}
446446
static inline void mi_lock_done(mi_lock_t* lock) {
447-
(void)(lock);
447+
pthread_mutex_destroy(lock);
448448
}
449449

450-
450+
/*
451451
#elif defined(__cplusplus)
452452
453453
#include <mutex>
@@ -469,6 +469,7 @@ static inline void mi_lock_init(mi_lock_t* lock) {
469469
static inline void mi_lock_done(mi_lock_t* lock) {
470470
(void)(lock);
471471
}
472+
*/
472473

473474
#else
474475

src/arena.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ void _mi_arena_field_cursor_init(mi_heap_t* heap, mi_subproc_t* subproc, mi_aren
863863
current->start = (heap == NULL || max_arena == 0 ? 0 : (mi_arena_id_t)(_mi_heap_random_next(heap) % max_arena));
864864
current->end = current->start + max_arena;
865865
}
866-
mi_assert_internal(current->start < max_arena);
866+
mi_assert_internal(current->start <= max_arena);
867867
}
868868

869869
static mi_segment_t* mi_arena_segment_clear_abandoned_at(mi_arena_t* arena, mi_subproc_t* subproc, mi_bitmap_index_t bitmap_idx) {

0 commit comments

Comments
 (0)