Changeset 3159 for trunk/src/kmk/job.c
- Timestamp:
- Mar 19, 2018, 2:37:13 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/job.c
r3156 r3159 42 42 int no_default_sh_exe = 1; 43 43 int batch_mode_shell = 1; 44 # ifndef CONFIG_NEW_WIN32_CTRL_EVENT 44 45 HANDLE main_thread; 46 # endif 45 47 46 48 #elif defined (_AMIGA) … … 813 815 #endif /* _AMIGA */ 814 816 #ifdef WINDOWS32 817 { 815 818 # ifndef CONFIG_NEW_WIN_CHILDREN 816 {817 819 HANDLE hPID; 818 820 HANDLE hcTID, hcPID; … … 822 824 coredump = 0; 823 825 826 # ifndef CONFIG_NEW_WIN32_CTRL_EVENT 824 827 /* Record the thread ID of the main process, so that we 825 828 could suspend it in the signal handler. */ … … 839 842 DB (DB_VERBOSE, ("Main thread handle = %p\n", main_thread)); 840 843 } 844 # endif 841 845 842 846 /* wait for anything to finish */ … … 875 879 876 880 pid = (pid_t) hPID; 881 # else /* CONFIG_NEW_WIN_CHILDREN */ 882 # ifndef CONFIG_NEW_WIN32_CTRL_EVENT 883 /* Ctrl-C handler needs to suspend the main thread handle to 884 prevent mayhem when concurrently calling reap_children. */ 885 if ( !main_thread 886 && !DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), 887 GetCurrentProcess (), &main_thread, 0, 888 FALSE, DUPLICATE_SAME_ACCESS)) 889 fprintf (stderr, "Failed to duplicate main thread handle: %u\n", 890 GetLastError ()); 891 # endif 892 893 assert (!any_remote); 894 pid = 0; 895 coredump = exit_sig = exit_code = 0; 896 { 897 int rc = MkWinChildWait(block, &pid, &exit_code, &exit_sig, &coredump, &c); 898 if (rc != 0) 899 ON (fatal, NILF, _("MkWinChildWait: %u"), rc); 900 } 901 if (pid == 0) 902 { 903 /* No more children, stop. */ 904 reap_more = 0; 905 break; 906 } 907 908 /* If we have started jobs in this second, remove one. */ 909 if (job_counter) 910 --job_counter; 911 # endif /* CONFIG_NEW_WIN_CHILDREN */ 877 912 } 878 # else /* CONFIG_NEW_WIN_CHILDREN */879 assert (!any_remote);880 pid = 0;881 coredump = exit_sig = exit_code = 0;882 {883 int rc = MkWinChildWait(block, &pid, &exit_code, &exit_sig, &coredump, &c);884 if (rc != 0)885 ON (fatal, NILF, _("MkWinChildWait: %u"), rc);886 }887 if (pid == 0)888 {889 /* No more children, stop. */890 reap_more = 0;891 break;892 }893 894 /* If we have started jobs in this second, remove one. */895 if (job_counter)896 --job_counter;897 # endif /* CONFIG_NEW_WIN_CHILDREN */898 913 #endif /* WINDOWS32 */ 899 914 }
Note:
See TracChangeset
for help on using the changeset viewer.