@@ -440,6 +440,7 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
440440 }
441441
442442 const bool hideUserlandThreads = dpt -> super .super .host -> settings -> hideUserlandThreads ;
443+ bool isProcessStuck = false;
443444
444445 for (mach_msg_type_number_t i = 0 ; i < thread_count ; i ++ ) {
445446
@@ -490,6 +491,11 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
490491 tdproc -> super .time = (extended_info .pth_system_time + extended_info .pth_user_time ) / 10000000 ;
491492 tdproc -> super .priority = extended_info .pth_curpri ;
492493
494+ if (extended_info .pth_run_state == TH_STATE_UNINTERRUPTIBLE ) {
495+ isProcessStuck |= true;
496+ tdproc -> super .state = UNINTERRUPTIBLE_WAIT ;
497+ }
498+
493499 // TODO: depend on setting
494500 const char * name = extended_info .pth_name [0 ] != '\0' ? extended_info .pth_name : proc -> procComm ;
495501 Process_updateCmdline (tprocess , name , 0 , strlen (name ));
@@ -498,6 +504,10 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) {
498504 ProcessTable_add (& dpt -> super , tprocess );
499505 }
500506
507+ if (isProcessStuck ) {
508+ dp -> super .state = UNINTERRUPTIBLE_WAIT ;
509+ }
510+
501511 vm_deallocate (mach_task_self (), (vm_address_t ) thread_list , sizeof (thread_port_array_t ) * thread_count );
502512 mach_port_deallocate (mach_task_self (), task );
503513}
0 commit comments