diff options
author | midipix <writeonce@midipix.org> | 2019-06-08 13:40:06 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2019-06-08 14:53:40 +0000 |
commit | ae5d60dcef6bd4404548e79fbad020dff22f844e (patch) | |
tree | 1a31d4b6b88556232bb0ab2751f75256ad675d6f /src/pty | |
parent | 1c0e99025e598f2877e7034f5502b36b46a7819c (diff) | |
download | ntapi-ae5d60dcef6bd4404548e79fbad020dff22f844e.tar.bz2 ntapi-ae5d60dcef6bd4404548e79fbad020dff22f844e.tar.xz |
struct nt_pty_context(): replace the .sync member with a simple atomic lock.
Diffstat (limited to 'src/pty')
-rw-r--r-- | src/pty/ntapi_pty_fd.c | 11 |
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; } |