summaryrefslogtreecommitdiffhomepage
path: root/src/pty/ntapi_pty_fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pty/ntapi_pty_fd.c')
-rw-r--r--src/pty/ntapi_pty_fd.c11
1 files changed, 8 insertions, 3 deletions
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 <psxtypes/psxtypes.h>
+#include <ntapi/nt_atomic.h>
#include <ntapi/nt_port.h>
#include <ntapi/nt_tty.h>
#include <ntapi/ntapi.h>
@@ -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;
}