Skip to content

Commit 20d05fe

Browse files
committed
adjust names of a few statics
1 parent c1f0b4f commit 20d05fe

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/workqueue/workqueue.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@
6363
static volatile int32_t _dispatch_workq_runnable_workers;
6464

6565
/* The desired minimum number of runnable worker threads */
66-
static int32_t _dispatch_workq_target_runnable_workers;
66+
static int32_t _dispatch_workq_min_runnable_workers;
6767

6868
/* The desired maximum number of runnable worker threads */
69-
static int32_t _dispatch_workq_target_max_runnable_workers;
69+
static int32_t _dispatch_workq_max_runnable_workers;
7070

7171
/* Limit on the total number of worker threads that can be created. */
72-
static int32_t _dispatch_workq_max_total_workers;
72+
static int32_t _dispatch_workq_max_spawned_workers;
7373

7474
#if DISPATCH_ENABLE_PWQ_KEXT
7575
/* Are we using user-level or kext based management? */
@@ -124,7 +124,7 @@ void _dispatch_workq_worker_register_kext(void);
124124
void _dispatch_workq_worker_unregister_kext(void);
125125
void _dispatch_workq_work_added_kext(void);
126126
void _dispatch_workq_worker_wait_kext(void);
127-
void* dispatch_workq_thread_monitor_main_kext(void *context DISPATCH_UNUSED);
127+
void* _dispatch_workq_thread_monitor_main_kext(void *context DISPATCH_UNUSED);
128128
#endif // DISPATCH_ENABLE_PWQ_KEXT
129129

130130
#pragma mark Workqueue internal data structures and functions
@@ -258,14 +258,14 @@ _dispatch_workq_init_once(void *context DISPATCH_UNUSED)
258258
high_target = MIN(high_target, max);
259259
}
260260
}
261-
_dispatch_workq_target_runnable_workers = low_target;
262-
_dispatch_workq_target_max_runnable_workers = high_target;
263-
_dispatch_workq_max_total_workers = max;
261+
_dispatch_workq_min_runnable_workers = low_target;
262+
_dispatch_workq_max_runnable_workers = high_target;
263+
_dispatch_workq_max_spawned_workers = max;
264264

265265
// Must come after _dispatch_workqueue_management_init() sets threadpool_verbose
266266
_dispatch_debug("workq: normal pool targets: %d...%d with max of %d",
267-
_dispatch_workq_target_runnable_workers, _dispatch_workq_target_max_runnable_workers,
268-
_dispatch_workq_max_total_workers);
267+
_dispatch_workq_min_runnable_workers, _dispatch_workq_max_runnable_workers,
268+
_dispatch_workq_max_spawned_workers);
269269

270270
// Now that we have set threadpool parameters, initialize the management subsystem
271271
_dispatch_workq_management_init();
@@ -284,7 +284,7 @@ _dispatch_workq_init_once(void *context DISPATCH_UNUSED)
284284
WORKQ_NUM_PRIORITIES, false);
285285

286286
// create initial set of normal workers
287-
for (int i=0; i<_dispatch_workq_target_runnable_workers; i++) {
287+
for (int i=0; i<_dispatch_workq_min_runnable_workers; i++) {
288288
_dispatch_workq_spawn_thread(_dispatch_workq_normal_worker_main);
289289
}
290290
}
@@ -335,7 +335,7 @@ dispatch_workq_additem_np(dispatch_workqueue_t workq,
335335
STAILQ_INSERT_TAIL(&workq->item_listhead, wi, item_entry);
336336
_dispatch_unfair_lock_unlock(&workq->lock);
337337

338-
if (unlikely(_dispatch_workq_runnable_workers < _dispatch_workq_target_max_runnable_workers)) {
338+
if (unlikely(_dispatch_workq_runnable_workers < _dispatch_workq_max_runnable_workers)) {
339339
_dispatch_workq_work_added();
340340
}
341341
}
@@ -358,7 +358,7 @@ _dispatch_workq_add_control_item(void *op_code)
358358
STAILQ_INSERT_TAIL(&workq->item_listhead, wi, item_entry);
359359
_dispatch_unfair_lock_unlock(&workq->lock);
360360

361-
if (unlikely(_dispatch_workq_runnable_workers < _dispatch_workq_target_max_runnable_workers)) {
361+
if (unlikely(_dispatch_workq_runnable_workers < _dispatch_workq_max_runnable_workers)) {
362362
_dispatch_workq_work_added();
363363
}
364364
}
@@ -558,7 +558,7 @@ _dispatch_workq_management_init(void)
558558
_dispatch_workq_kext_active = _dispatch_workqueue_management_init_kext();
559559

560560
if (_dispatch_workq_kext_active) {
561-
_dispatch_spawn_thread(dispatch_thread_monitor_main_kext);
561+
_dispatch_spawn_thread(_dispatch_thread_monitor_main_kext);
562562
return;
563563
}
564564
#endif
@@ -573,7 +573,7 @@ _dispatch_workq_management_init(void)
573573
(void)dispatch_assume_zero(r);
574574

575575
_dispatch_workq_manager.registered_workers =
576-
_dispatch_calloc(_dispatch_workq_max_total_workers, sizeof(pid_t));
576+
_dispatch_calloc(_dispatch_workq_max_spawned_workers, sizeof(pid_t));
577577

578578
// spawn a thread to periodically estimate the number
579579
// of runnable workers and add/subtract to maintain target
@@ -593,7 +593,7 @@ _dispatch_workq_worker_register(void)
593593
int tid = syscall(SYS_gettid);
594594
int r = pthread_mutex_lock(&_dispatch_workq_manager.registered_worker_mutex);
595595
(void)dispatch_assume_zero(r);
596-
if (_dispatch_workq_manager.num_registered_workers < _dispatch_workq_max_total_workers-1) {
596+
if (_dispatch_workq_manager.num_registered_workers < _dispatch_workq_max_spawned_workers-1) {
597597
int worker_id = _dispatch_workq_manager.num_registered_workers++;
598598
_dispatch_workq_manager.registered_workers[worker_id] = tid;
599599
rc = 0;
@@ -640,7 +640,7 @@ _dispatch_workq_work_added(void)
640640
return;
641641
}
642642
#endif
643-
if ((_dispatch_workq_runnable_workers < _dispatch_workq_target_max_runnable_workers)
643+
if ((_dispatch_workq_runnable_workers < _dispatch_workq_max_runnable_workers)
644644
&& (_dispatch_workq_manager.num_spare_workers > 0)) {
645645
int r = pthread_mutex_lock(&_dispatch_workq_manager.spare_worker_mutex);
646646
(void)dispatch_assume_zero(r);
@@ -794,10 +794,10 @@ _dispatch_workq_thread_monitor_main(void *context DISPATCH_UNUSED)
794794

795795
_dispatch_debug("workq: %d runnable of %d total workers (target runnable: %d..%d)",
796796
_dispatch_workq_runnable_workers, _dispatch_workq_manager.num_registered_workers,
797-
_dispatch_workq_target_runnable_workers, _dispatch_workq_target_max_runnable_workers);
797+
_dispatch_workq_min_runnable_workers, _dispatch_workq_max_runnable_workers);
798798

799799
// Not enough workers running and there appears to be work in queues.
800-
if ((_dispatch_workq_runnable_workers < _dispatch_workq_target_runnable_workers) &&
800+
if ((_dispatch_workq_runnable_workers < _dispatch_workq_min_runnable_workers) &&
801801
(os_atomic_load(&_dispatch_workq_normal_pool.mask, relaxed) != 0)) {
802802
r = pthread_mutex_lock(&_dispatch_workq_manager.spare_worker_mutex);
803803
(void)dispatch_assume_zero(r);
@@ -814,8 +814,8 @@ _dispatch_workq_thread_monitor_main(void *context DISPATCH_UNUSED)
814814
}
815815

816816
// Too many runnable workers
817-
if (_dispatch_workq_runnable_workers > _dispatch_workq_target_max_runnable_workers) {
818-
int over = _dispatch_workq_runnable_workers - _dispatch_workq_target_max_runnable_workers;
817+
if (_dispatch_workq_runnable_workers > _dispatch_workq_max_runnable_workers) {
818+
int over = _dispatch_workq_runnable_workers - _dispatch_workq_max_runnable_workers;
819819
int pendingWaits = os_atomic_load(&_dispatch_workq_manager.num_pending_waits, relaxed);
820820
if (pendingWaits < over) {
821821
os_atomic_inc(&_dispatch_workq_manager.num_pending_waits, relaxed);

0 commit comments

Comments
 (0)