@@ -440,6 +440,7 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
440
440
}
441
441
442
442
const bool hideUserlandThreads = dpt -> super .super .host -> settings -> hideUserlandThreads ;
443
+ bool isProcessStuck = false;
443
444
444
445
for (mach_msg_type_number_t i = 0 ; i < thread_count ; i ++ ) {
445
446
@@ -490,6 +491,11 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
490
491
tdproc -> super .time = (extended_info .pth_system_time + extended_info .pth_user_time ) / 10000000 ;
491
492
tdproc -> super .priority = extended_info .pth_curpri ;
492
493
494
+ if (extended_info .pth_run_state == TH_STATE_UNINTERRUPTIBLE ) {
495
+ isProcessStuck |= true;
496
+ tdproc -> super .state = UNINTERRUPTIBLE_WAIT ;
497
+ }
498
+
493
499
// TODO: depend on setting
494
500
const char * name = extended_info .pth_name [0 ] != '\0' ? extended_info .pth_name : proc -> procComm ;
495
501
Process_updateCmdline (tprocess , name , 0 , strlen (name ));
@@ -498,6 +504,10 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
498
504
ProcessTable_add (& dpt -> super , tprocess );
499
505
}
500
506
507
+ if (isProcessStuck ) {
508
+ dp -> super .state = UNINTERRUPTIBLE_WAIT ;
509
+ }
510
+
501
511
vm_deallocate (mach_task_self (), (vm_address_t ) thread_list , sizeof (thread_port_array_t ) * thread_count );
502
512
mach_port_deallocate (mach_task_self (), task );
503
513
}
0 commit comments