@@ -553,7 +553,7 @@ dispatch_assert_queue(dispatch_queue_t dq)
553553 if (unlikely (_dq_state_drain_pended (dq_state ))) {
554554 goto fail ;
555555 }
556- if (likely (_dq_state_drain_owner (dq_state ) == _dispatch_thread_port ())) {
556+ if (likely (_dq_state_drain_owner (dq_state ) == _dispatch_tid_self ())) {
557557 return ;
558558 }
559559 if (likely (dq -> dq_width > 1 )) {
@@ -580,7 +580,7 @@ dispatch_assert_queue_not(dispatch_queue_t dq)
580580 if (_dq_state_drain_pended (dq_state )) {
581581 return ;
582582 }
583- if (likely (_dq_state_drain_owner (dq_state ) != _dispatch_thread_port ())) {
583+ if (likely (_dq_state_drain_owner (dq_state ) != _dispatch_tid_self ())) {
584584 if (likely (dq -> dq_width == 1 )) {
585585 // we can look at the width: if it is changing while we read it,
586586 // it means that a barrier is running on `dq` concurrently, which
@@ -1602,7 +1602,7 @@ _dispatch_queue_resume(dispatch_queue_t dq, bool activate)
16021602 DISPATCH_QUEUE_WIDTH_FULL_BIT ) {
16031603 value = full_width ;
16041604 value &= ~DISPATCH_QUEUE_DIRTY ;
1605- value |= _dispatch_thread_port ();
1605+ value |= _dispatch_tid_self ();
16061606 }
16071607 }
16081608 }
@@ -2334,7 +2334,7 @@ _dispatch_queue_is_exclusively_owned_by_current_thread_4IOHID(
23342334 DISPATCH_CLIENT_CRASH (dq -> dq_width , "Invalid queue type" );
23352335 }
23362336 uint64_t dq_state = os_atomic_load2o (dq , dq_state , relaxed );
2337- return _dq_state_drain_locked_by (dq_state , _dispatch_thread_port ());
2337+ return _dq_state_drain_locked_by (dq_state , _dispatch_tid_self ());
23382338}
23392339#endif
23402340
@@ -2471,7 +2471,7 @@ _dispatch_set_priority_and_mach_voucher_slow(pthread_priority_t pp,
24712471 pflags |= _PTHREAD_SET_SELF_QOS_FLAG ;
24722472 }
24732473 if (unlikely (DISPATCH_QUEUE_DRAIN_OWNER (& _dispatch_mgr_q ) ==
2474- _dispatch_thread_port ())) {
2474+ _dispatch_tid_self ())) {
24752475 DISPATCH_INTERNAL_CRASH (pp ,
24762476 "Changing the QoS while on the manager queue" );
24772477 }
@@ -2775,7 +2775,7 @@ _dispatch_block_invoke_direct(const struct dispatch_block_private_data_s *dbcpd)
27752775 v = dbpd -> dbpd_voucher ;
27762776 }
27772777 ov = _dispatch_adopt_priority_and_set_voucher (p , v , adopt_flags );
2778- dbpd -> dbpd_thread = _dispatch_thread_port ();
2778+ dbpd -> dbpd_thread = _dispatch_tid_self ();
27792779 _dispatch_client_callout (dbpd -> dbpd_block ,
27802780 _dispatch_Block_invoke (dbpd -> dbpd_block ));
27812781 _dispatch_reset_priority_and_voucher (op , ov );
@@ -3125,7 +3125,7 @@ _dispatch_async_redirect_invoke(dispatch_continuation_t dc,
31253125 old_dp = _dispatch_set_defaultpriority (dq -> dq_priority , & dp );
31263126 op = dq -> dq_override ;
31273127 if (op > (dp & _PTHREAD_PRIORITY_QOS_CLASS_MASK )) {
3128- _dispatch_wqthread_override_start (_dispatch_thread_port (), op );
3128+ _dispatch_wqthread_override_start (_dispatch_tid_self (), op );
31293129 // Ensure that the root queue sees that this thread was overridden.
31303130 _dispatch_set_defaultpriority_override ();
31313131 }
@@ -3545,7 +3545,7 @@ _dispatch_barrier_sync_f_slow(dispatch_queue_t dq, void *ctxt,
35453545 _dispatch_introspection_barrier_sync_begin (dq , func );
35463546 }
35473547#endif
3548- uint32_t th_self = _dispatch_thread_port ();
3548+ uint32_t th_self = _dispatch_tid_self ();
35493549 struct dispatch_continuation_s dbss = {
35503550 .dc_flags = DISPATCH_OBJ_BARRIER_BIT | DISPATCH_OBJ_SYNC_SLOW_BIT ,
35513551 .dc_func = _dispatch_barrier_sync_f_slow_invoke ,
@@ -3711,7 +3711,7 @@ _dispatch_non_barrier_complete(dispatch_queue_t dq)
37113711 DISPATCH_QUEUE_WIDTH_FULL_BIT ) {
37123712 new_state = full_width ;
37133713 new_state &= ~DISPATCH_QUEUE_DIRTY ;
3714- new_state |= _dispatch_thread_port ();
3714+ new_state |= _dispatch_tid_self ();
37153715 }
37163716 }
37173717 }
@@ -3738,7 +3738,7 @@ _dispatch_sync_f_slow(dispatch_queue_t dq, void *ctxt, dispatch_function_t func,
37383738 }
37393739 dispatch_thread_event_s event ;
37403740 _dispatch_thread_event_init (& event );
3741- uint32_t th_self = _dispatch_thread_port ();
3741+ uint32_t th_self = _dispatch_tid_self ();
37423742 struct dispatch_continuation_s dc = {
37433743 .dc_flags = DISPATCH_OBJ_SYNC_SLOW_BIT ,
37443744#if DISPATCH_INTROSPECTION
@@ -4438,7 +4438,7 @@ _dispatch_main_queue_drain(void)
44384438 " after dispatch_main()" );
44394439 }
44404440 mach_port_t owner = DISPATCH_QUEUE_DRAIN_OWNER (dq );
4441- if (slowpath (owner != _dispatch_thread_port ())) {
4441+ if (slowpath (owner != _dispatch_tid_self ())) {
44424442 DISPATCH_CLIENT_CRASH (owner , "_dispatch_main_queue_callback_4CF called"
44434443 " from the wrong thread" );
44444444 }
@@ -4663,7 +4663,7 @@ _dispatch_queue_drain_deferred_invoke(dispatch_queue_t dq,
46634663 }
46644664
46654665 if (dq ) {
4666- uint32_t self = _dispatch_thread_port ();
4666+ uint32_t self = _dispatch_tid_self ();
46674667 os_atomic_rmw_loop2o (dq , dq_state , old_state , new_state , release ,{
46684668 new_state = old_state ;
46694669 if (!_dq_state_drain_pended (old_state ) ||
@@ -5094,7 +5094,7 @@ _dispatch_queue_class_wakeup(dispatch_queue_t dq, pthread_priority_t pp,
50945094 uint64_t pending_barrier_width =
50955095 (dq -> dq_width - 1 ) * DISPATCH_QUEUE_WIDTH_INTERVAL ;
50965096 uint64_t xor_owner_and_set_full_width_and_in_barrier =
5097- _dispatch_thread_port () | DISPATCH_QUEUE_WIDTH_FULL_BIT |
5097+ _dispatch_tid_self () | DISPATCH_QUEUE_WIDTH_FULL_BIT |
50985098 DISPATCH_QUEUE_IN_BARRIER ;
50995099
51005100#ifdef DLOCK_NOWAITERS_BIT
0 commit comments