summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/ptycon.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ptycon.c b/src/ptycon.c
index 5caa104..323ab51 100644
--- a/src/ptycon.c
+++ b/src/ptycon.c
@@ -122,14 +122,15 @@ static int32_t ptycon_start(int argc, char ** argv, char ** envp)
return ptyc_main(argc,argv,envp);
}
-static int __stdcall ptycon_daemon_entry_point(void * arg)
+static int __stdcall ptycon_daemon_entry_point(void * hswap)
{
int32_t status;
int argc;
char ** argv;
char ** envp;
- (void)arg;
+ ntapi->zw_set_event(hswap,0);
+ ntapi->zw_close(hswap);
if ((status = ntapi->tt_get_argv_envp_utf8(
&argc,&argv,&envp,
@@ -146,15 +147,23 @@ int ptycon_entry_point(void)
{
int32_t status;
nt_thread_params params;
+ void * hswap;
if ((status = ptyc_init()))
return status;
+ if ((status = ntapi->tt_create_private_event(
+ &hswap,
+ NT_NOTIFICATION_EVENT,
+ NT_EVENT_NOT_SIGNALED)))
+ return status;
+
ntapi->tt_aligned_block_memset(
&params,0,sizeof(params));
params.hprocess = NT_CURRENT_PROCESS_HANDLE;
params.start = ptycon_daemon_entry_point;
+ params.arg = hswap;
params.stack_size_commit = 128 * 1024;
params.stack_size_reserve = 128 * 1024;
params.creation_flags = NT_CREATE_LOCAL_THREAD;
@@ -162,6 +171,9 @@ int ptycon_entry_point(void)
if ((status = ntapi->tt_create_thread(&params)))
ptycon_exit(status);
+ ntapi->zw_wait_for_single_object(
+ hswap,NT_SYNC_NON_ALERTABLE,0);
+
ntapi->zw_close(
params.hthread);