Skip to content

Commit 464cb60

Browse files
committed
Move background thread creation to background_thread_0.
To avoid complications, avoid invoking pthread_create "internally", instead rely on thread0 to launch new threads, and also terminating threads when asked.
1 parent 13685ab commit 464cb60

File tree

4 files changed

+251
-146
lines changed

4 files changed

+251
-146
lines changed

include/jemalloc/internal/background_thread_externs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ extern background_thread_info_t *background_thread_info;
1010
bool background_thread_create(tsd_t *tsd, unsigned arena_ind);
1111
bool background_threads_enable(tsd_t *tsd);
1212
bool background_threads_disable(tsd_t *tsd);
13-
bool background_threads_disable_single(tsd_t *tsd,
14-
background_thread_info_t *info);
1513
void background_thread_interval_check(tsdn_t *tsdn, arena_t *arena,
1614
arena_decay_t *decay, size_t npages_new);
1715
void background_thread_prefork0(tsdn_t *tsdn);

include/jemalloc/internal/background_thread_structs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ struct background_thread_info_s {
1818
malloc_mutex_t mtx;
1919
/* Whether the thread has been created. */
2020
bool started;
21+
/* Pause execution (for arena reset / destroy). */
22+
bool pause;
2123
/* When true, it means no wakeup scheduled. */
2224
atomic_b_t indefinite_sleep;
2325
/* Next scheduled wakeup time (absolute time in ns). */

0 commit comments

Comments
 (0)