From ae5d60dcef6bd4404548e79fbad020dff22f844e Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 8 Jun 2019 13:40:06 +0000 Subject: struct nt_pty_context(): replace the .sync member with a simple atomic lock. --- src/pty/ntapi_pty_fd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/pty') diff --git a/src/pty/ntapi_pty_fd.c b/src/pty/ntapi_pty_fd.c index 45a58ff..2e79417 100644 --- a/src/pty/ntapi_pty_fd.c +++ b/src/pty/ntapi_pty_fd.c @@ -5,6 +5,7 @@ /********************************************************/ #include +#include #include #include #include @@ -111,6 +112,10 @@ static int32_t __fastcall __ntapi_pty_alloc(nt_pty ** pty) ctx->addr = ctx; ctx->size = ctx_size; + /* atomic lock reset */ + at_store_32(&ctx->lock[__PTY_READ],0); + at_store_32(&ctx->lock[__PTY_WRITE],0); + *pty = ctx; return NT_STATUS_SUCCESS; } @@ -155,9 +160,9 @@ static int32_t __ntapi_pty_connect( NT_PAGE_READWRITE))) return __ntapi_pty_fail(ctx,status); - /* assume conforming clients, config for single lock try */ - __ntapi->tt_sync_block_init(&ctx->sync[__PTY_READ],0,0,1,0,0); - __ntapi->tt_sync_block_init(&ctx->sync[__PTY_WRITE],0,0,1,0,0); + /* atomic lock reset */ + at_store_32(&ctx->lock[__PTY_READ],0); + at_store_32(&ctx->lock[__PTY_WRITE],0); return NT_STATUS_SUCCESS; } -- cgit v1.2.3