summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/process/ntapi_tt_fork_v1.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/process/ntapi_tt_fork_v1.c b/src/process/ntapi_tt_fork_v1.c
index eeee49b..74e0b7e 100644
--- a/src/process/ntapi_tt_fork_v1.c
+++ b/src/process/ntapi_tt_fork_v1.c
@@ -166,15 +166,20 @@ intptr_t __fastcall __ntapi_tt_fork_v1(
timeout.quad = (-1) * 10 * 1000 * __NT_FORK_CHILD_WAIT_MILLISEC;
htty_connected = 0;
- if (at_locked_cas(&__internals->hlock,0,1))
- return (intptr_t)(-1);
+ while (at_locked_cas(&__internals->hlock,0,1))
+ __ntapi->zw_delay_execution(
+ NT_SYNC_NON_ALERTABLE,
+ &(nt_timeout){{0,0}});
- if (hport_session && *hport_session)
+ if (hport_session && *hport_session) {
if (__ntapi_tt_create_inheritable_event(
&htty_connected,
NT_NOTIFICATION_EVENT,
- NT_EVENT_NOT_SIGNALED))
+ NT_EVENT_NOT_SIGNALED)) {
+ at_store(&__internals->hlock,0);
return (intptr_t)(-1);
+ }
+ }
pid = __tt_fork_v1();