From 757f569715ad53760b5853c36d6ac5164c07b442 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 22 Mar 2012 10:09:29 +0100 Subject: Signaler's global event is now accessible by everyone Signed-off-by: Martin Sustrik --- src/signaler.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/signaler.cpp') diff --git a/src/signaler.cpp b/src/signaler.cpp index 2ba6285..d9a308e 100644 --- a/src/signaler.cpp +++ b/src/signaler.cpp @@ -245,11 +245,22 @@ int xs::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) // implement IOCP polling mechanism that allows to poll on both sockets // and in-process synchronisation objects. + // Make the following critical section accessible to everyone. + SECURITY_ATTRIBUTES sa = {0}; + sa.nLength = sizeof (sa); + sa.bInheritHandle = FALSE; + SECURITY_DESCRIPTOR sd; + BOOL ok = InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION); + win_assert (ok); + ok = SetSecurityDescriptorDacl(&sd, TRUE, (PACL) NULL, FALSE); + win_assert (ok); + sa.lpSecurityDescriptor = &sd; + // This function has to be in a system-wide critical section so that // two instances of the library don't accidentally create signaler // crossing the process boundary. // We'll use named event object to implement the critical section. - HANDLE sync = CreateEvent (NULL, FALSE, TRUE, "xs-signaler-port-sync"); + HANDLE sync = CreateEvent (&sa, FALSE, TRUE, "xs-signaler-port-sync"); win_assert (sync != NULL); // Enter the critical section. -- cgit v1.2.3