summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-12-03 21:45:34 +0000
committermidipix <writeonce@midipix.org>2020-12-04 13:24:15 +0000
commitda8524f795dd4db68540b80d3c7e5a10132da79f (patch)
treec614e9d47c2ca91848a1d0745b5ef89571be6420
parent736fac2ce594fb10c75f27dea42742498987b90c (diff)
downloadntapi-da8524f795dd4db68540b80d3c7e5a10132da79f.tar.bz2
ntapi-da8524f795dd4db68540b80d3c7e5a10132da79f.tar.xz
__ipc_connect_by_attr(): obtain atomic lock via loop as needed.
-rw-r--r--src/ipc/ntapi_ipc_connect.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ipc/ntapi_ipc_connect.c b/src/ipc/ntapi_ipc_connect.c
index 2d0e4b7..8f0d8e1 100644
--- a/src/ipc/ntapi_ipc_connect.c
+++ b/src/ipc/ntapi_ipc_connect.c
@@ -311,8 +311,10 @@ static int32_t __ipc_connect_by_attr(
/* lock */
hlock = &(__internals->hlock);
- if (at_locked_cas(hlock,0,1))
- return NT_STATUS_RESOURCE_NOT_OWNED;
+ while (at_locked_cas(hlock,0,1))
+ __ntapi->zw_delay_execution(
+ NT_SYNC_NON_ALERTABLE,
+ &(nt_timeout){{0,0}});
/* already connected? */
node = (struct dalist_node_ex *)__internals->ipc_conns.head;