[1] | 1 | /* $Id: semeventmulti-win.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
[25381] | 3 | * IPRT - Multiple Release Event Semaphore, Windows.
|
---|
[25654] | 4 | *
|
---|
| 5 | * @remarks This file is identical to semevent-win.cpp except for the 2nd
|
---|
| 6 | * CreateEvent parameter, the reset function and the "Multi" infix.
|
---|
[1] | 7 | */
|
---|
| 8 |
|
---|
| 9 | /*
|
---|
[98103] | 10 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[1] | 11 | *
|
---|
[96407] | 12 | * This file is part of VirtualBox base platform packages, as
|
---|
| 13 | * available from https://www.virtualbox.org.
|
---|
[5999] | 14 | *
|
---|
[96407] | 15 | * This program is free software; you can redistribute it and/or
|
---|
| 16 | * modify it under the terms of the GNU General Public License
|
---|
| 17 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 18 | * License.
|
---|
| 19 | *
|
---|
| 20 | * This program is distributed in the hope that it will be useful, but
|
---|
| 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 23 | * General Public License for more details.
|
---|
| 24 | *
|
---|
| 25 | * You should have received a copy of the GNU General Public License
|
---|
| 26 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 27 | *
|
---|
[5999] | 28 | * The contents of this file may alternatively be used under the terms
|
---|
| 29 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 30 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 31 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
[5999] | 32 | * CDDL are applicable instead of those of the GPL.
|
---|
| 33 | *
|
---|
| 34 | * You may elect to license modified versions of this file under the
|
---|
| 35 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[96407] | 36 | *
|
---|
| 37 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[1] | 38 | */
|
---|
| 39 |
|
---|
| 40 |
|
---|
[57358] | 41 | /*********************************************************************************************************************************
|
---|
| 42 | * Header Files *
|
---|
| 43 | *********************************************************************************************************************************/
|
---|
[1] | 44 | #define LOG_GROUP RTLOGGROUP_SEMAPHORE
|
---|
[62592] | 45 | #include <iprt/win/windows.h>
|
---|
[1] | 46 |
|
---|
| 47 | #include <iprt/semaphore.h>
|
---|
[25654] | 48 | #include "internal/iprt.h"
|
---|
| 49 |
|
---|
| 50 | #include <iprt/asm.h>
|
---|
[1] | 51 | #include <iprt/assert.h>
|
---|
| 52 | #include <iprt/err.h>
|
---|
[25654] | 53 | #include <iprt/lockvalidator.h>
|
---|
| 54 | #include <iprt/mem.h>
|
---|
| 55 | #include <iprt/thread.h>
|
---|
[32970] | 56 | #include <iprt/time.h>
|
---|
[25654] | 57 | #include "internal/magics.h"
|
---|
[8651] | 58 | #include "internal/strict.h"
|
---|
[1] | 59 |
|
---|
| 60 |
|
---|
[57358] | 61 | /*********************************************************************************************************************************
|
---|
| 62 | * Defined Constants And Macros *
|
---|
| 63 | *********************************************************************************************************************************/
|
---|
[25654] | 64 | struct RTSEMEVENTMULTIINTERNAL
|
---|
| 65 | {
|
---|
| 66 | /** Magic value (RTSEMEVENTMULTI_MAGIC). */
|
---|
| 67 | uint32_t u32Magic;
|
---|
| 68 | /** The event handle. */
|
---|
| 69 | HANDLE hev;
|
---|
| 70 | #ifdef RTSEMEVENT_STRICT
|
---|
| 71 | /** Signallers. */
|
---|
| 72 | RTLOCKVALRECSHRD Signallers;
|
---|
| 73 | /** Indicates that lock validation should be performed. */
|
---|
| 74 | bool volatile fEverHadSignallers;
|
---|
| 75 | #endif
|
---|
| 76 | };
|
---|
[1] | 77 |
|
---|
| 78 |
|
---|
| 79 |
|
---|
[25720] | 80 | RTDECL(int) RTSemEventMultiCreate(PRTSEMEVENTMULTI phEventMultiSem)
|
---|
| 81 | {
|
---|
| 82 | return RTSemEventMultiCreateEx(phEventMultiSem, 0 /*fFlags*/, NIL_RTLOCKVALCLASS, NULL);
|
---|
| 83 | }
|
---|
[25378] | 84 |
|
---|
[25720] | 85 |
|
---|
| 86 | RTDECL(int) RTSemEventMultiCreateEx(PRTSEMEVENTMULTI phEventMultiSem, uint32_t fFlags, RTLOCKVALCLASS hClass,
|
---|
| 87 | const char *pszNameFmt, ...)
|
---|
[1] | 88 | {
|
---|
[25720] | 89 | AssertReturn(!(fFlags & ~RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER);
|
---|
| 90 |
|
---|
[25654] | 91 | struct RTSEMEVENTMULTIINTERNAL *pThis = (struct RTSEMEVENTMULTIINTERNAL *)RTMemAlloc(sizeof(*pThis));
|
---|
| 92 | if (!pThis)
|
---|
| 93 | return VERR_NO_MEMORY;
|
---|
| 94 |
|
---|
[1] | 95 | /*
|
---|
| 96 | * Create the semaphore.
|
---|
| 97 | * (Manual reset, not signaled, private event object.)
|
---|
| 98 | */
|
---|
[25654] | 99 | pThis->hev = CreateEvent(NULL, TRUE, FALSE, NULL);
|
---|
| 100 | if (pThis->hev != NULL) /* not INVALID_HANDLE_VALUE */
|
---|
[1] | 101 | {
|
---|
[25654] | 102 | pThis->u32Magic = RTSEMEVENTMULTI_MAGIC;
|
---|
| 103 | #ifdef RTSEMEVENT_STRICT
|
---|
[25831] | 104 | if (!pszNameFmt)
|
---|
| 105 | {
|
---|
| 106 | static uint32_t volatile s_iSemEventMultiAnon = 0;
|
---|
| 107 | RTLockValidatorRecSharedInit(&pThis->Signallers, hClass, RTLOCKVAL_SUB_CLASS_ANY, pThis,
|
---|
| 108 | true /*fSignaller*/, !(fFlags & RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL),
|
---|
| 109 | "RTSemEventMulti-%u", ASMAtomicIncU32(&s_iSemEventMultiAnon) - 1);
|
---|
| 110 | }
|
---|
| 111 | else
|
---|
| 112 | {
|
---|
| 113 | va_list va;
|
---|
| 114 | va_start(va, pszNameFmt);
|
---|
| 115 | RTLockValidatorRecSharedInitV(&pThis->Signallers, hClass, RTLOCKVAL_SUB_CLASS_ANY, pThis,
|
---|
| 116 | true /*fSignaller*/, !(fFlags & RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL),
|
---|
| 117 | pszNameFmt, va);
|
---|
| 118 | va_end(va);
|
---|
| 119 | }
|
---|
[25654] | 120 | pThis->fEverHadSignallers = false;
|
---|
[62592] | 121 | #else
|
---|
| 122 | RT_NOREF_PV(hClass); RT_NOREF_PV(pszNameFmt);
|
---|
[25654] | 123 | #endif
|
---|
| 124 |
|
---|
[25720] | 125 | *phEventMultiSem = pThis;
|
---|
[1] | 126 | return VINF_SUCCESS;
|
---|
| 127 | }
|
---|
[25654] | 128 |
|
---|
| 129 | DWORD dwErr = GetLastError();
|
---|
| 130 | RTMemFree(pThis);
|
---|
| 131 | return RTErrConvertFromWin32(dwErr);
|
---|
[1] | 132 | }
|
---|
| 133 |
|
---|
| 134 |
|
---|
[25720] | 135 | RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hEventMultiSem)
|
---|
[1] | 136 | {
|
---|
[25720] | 137 | struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
|
---|
[25654] | 138 | if (pThis == NIL_RTSEMEVENT) /* don't bitch */
|
---|
[25720] | 139 | return VINF_SUCCESS;
|
---|
[25654] | 140 | AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
---|
| 141 | AssertReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, VERR_INVALID_HANDLE);
|
---|
| 142 |
|
---|
[1] | 143 | /*
|
---|
[25654] | 144 | * Invalidate the handle and close the semaphore.
|
---|
[1] | 145 | */
|
---|
[25654] | 146 | int rc = VINF_SUCCESS;
|
---|
| 147 | AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, ~RTSEMEVENTMULTI_MAGIC, RTSEMEVENTMULTI_MAGIC), VERR_INVALID_HANDLE);
|
---|
| 148 | if (CloseHandle(pThis->hev))
|
---|
| 149 | {
|
---|
| 150 | #ifdef RTSEMEVENT_STRICT
|
---|
| 151 | RTLockValidatorRecSharedDelete(&pThis->Signallers);
|
---|
| 152 | #endif
|
---|
| 153 | RTMemFree(pThis);
|
---|
| 154 | }
|
---|
| 155 | else
|
---|
| 156 | {
|
---|
| 157 | DWORD dwErr = GetLastError();
|
---|
| 158 | rc = RTErrConvertFromWin32(dwErr);
|
---|
[25720] | 159 | AssertMsgFailed(("Destroy hEventMultiSem %p failed, lasterr=%u (%Rrc)\n", pThis, dwErr, rc));
|
---|
[25654] | 160 | /* Leak it. */
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | return rc;
|
---|
[1] | 164 | }
|
---|
| 165 |
|
---|
| 166 |
|
---|
[25720] | 167 | RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEventMultiSem)
|
---|
[1] | 168 | {
|
---|
| 169 | /*
|
---|
[25654] | 170 | * Validate input.
|
---|
| 171 | */
|
---|
[25720] | 172 | struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
|
---|
[25654] | 173 | AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
---|
| 174 | AssertReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, VERR_INVALID_HANDLE);
|
---|
| 175 |
|
---|
| 176 | #ifdef RTSEMEVENT_STRICT
|
---|
| 177 | if (pThis->fEverHadSignallers)
|
---|
| 178 | {
|
---|
| 179 | int rc9 = RTLockValidatorRecSharedCheckSignaller(&pThis->Signallers, NIL_RTTHREAD);
|
---|
| 180 | if (RT_FAILURE(rc9))
|
---|
| 181 | return rc9;
|
---|
| 182 | }
|
---|
| 183 | #endif
|
---|
| 184 |
|
---|
| 185 | /*
|
---|
[1] | 186 | * Signal the object.
|
---|
| 187 | */
|
---|
[25654] | 188 | if (SetEvent(pThis->hev))
|
---|
[1] | 189 | return VINF_SUCCESS;
|
---|
[25654] | 190 | DWORD dwErr = GetLastError();
|
---|
[25720] | 191 | AssertMsgFailed(("Signaling hEventMultiSem %p failed, lasterr=%d\n", pThis, dwErr));
|
---|
[25654] | 192 | return RTErrConvertFromWin32(dwErr);
|
---|
[1] | 193 | }
|
---|
| 194 |
|
---|
| 195 |
|
---|
[25720] | 196 | RTDECL(int) RTSemEventMultiReset(RTSEMEVENTMULTI hEventMultiSem)
|
---|
[1] | 197 | {
|
---|
| 198 | /*
|
---|
[25654] | 199 | * Validate input.
|
---|
| 200 | */
|
---|
[25720] | 201 | struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
|
---|
[25654] | 202 | AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
---|
| 203 | AssertReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, VERR_INVALID_HANDLE);
|
---|
| 204 |
|
---|
| 205 | /*
|
---|
[1] | 206 | * Reset the object.
|
---|
| 207 | */
|
---|
[25654] | 208 | if (ResetEvent(pThis->hev))
|
---|
[1] | 209 | return VINF_SUCCESS;
|
---|
[25654] | 210 | DWORD dwErr = GetLastError();
|
---|
[25720] | 211 | AssertMsgFailed(("Resetting hEventMultiSem %p failed, lasterr=%d\n", pThis, dwErr));
|
---|
[25654] | 212 | return RTErrConvertFromWin32(dwErr);
|
---|
[1] | 213 | }
|
---|
| 214 |
|
---|
| 215 |
|
---|
[25659] | 216 | /** Goto avoidance. */
|
---|
[32970] | 217 | DECL_FORCE_INLINE(int)
|
---|
| 218 | rtSemEventWaitHandleStatus(struct RTSEMEVENTMULTIINTERNAL *pThis, uint32_t fFlags, DWORD rc)
|
---|
[25659] | 219 | {
|
---|
| 220 | switch (rc)
|
---|
| 221 | {
|
---|
| 222 | case WAIT_OBJECT_0: return VINF_SUCCESS;
|
---|
| 223 | case WAIT_TIMEOUT: return VERR_TIMEOUT;
|
---|
[32970] | 224 | case WAIT_IO_COMPLETION: return fFlags & RTSEMWAIT_FLAGS_RESUME ? VERR_TIMEOUT : VERR_INTERRUPTED;
|
---|
[25659] | 225 | case WAIT_ABANDONED: return VERR_SEM_OWNER_DIED;
|
---|
| 226 | default:
|
---|
| 227 | AssertMsgFailed(("%u\n", rc));
|
---|
| 228 | case WAIT_FAILED:
|
---|
| 229 | {
|
---|
| 230 | int rc2 = RTErrConvertFromWin32(GetLastError());
|
---|
[25720] | 231 | AssertMsgFailed(("Wait on hEventMultiSem %p failed, rc=%d lasterr=%d\n", pThis, rc, GetLastError()));
|
---|
[25659] | 232 | if (rc2)
|
---|
| 233 | return rc2;
|
---|
| 234 |
|
---|
| 235 | AssertMsgFailed(("WaitForSingleObject(event) -> rc=%d while converted lasterr=%d\n", rc, rc2));
|
---|
[62592] | 236 | RT_NOREF_PV(pThis);
|
---|
[25659] | 237 | return VERR_INTERNAL_ERROR;
|
---|
| 238 | }
|
---|
| 239 | }
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 |
|
---|
[32970] | 243 | DECLINLINE(int) rtSemEventMultiWinWait(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout,
|
---|
| 244 | PCRTLOCKVALSRCPOS pSrcPos)
|
---|
[1] | 245 | {
|
---|
| 246 | /*
|
---|
[25654] | 247 | * Validate input.
|
---|
| 248 | */
|
---|
[25720] | 249 | struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
|
---|
[25654] | 250 | AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
|
---|
| 251 | AssertReturn(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC, VERR_INVALID_HANDLE);
|
---|
[32970] | 252 | AssertReturn(RTSEMWAIT_FLAGS_ARE_VALID(fFlags), VERR_INVALID_PARAMETER);
|
---|
[25654] | 253 |
|
---|
| 254 | /*
|
---|
[32970] | 255 | * Convert the timeout to a millisecond count.
|
---|
[1] | 256 | */
|
---|
[32970] | 257 | uint64_t uAbsDeadline;
|
---|
| 258 | DWORD dwMsTimeout;
|
---|
| 259 | if (fFlags & RTSEMWAIT_FLAGS_INDEFINITE)
|
---|
| 260 | {
|
---|
| 261 | dwMsTimeout = INFINITE;
|
---|
| 262 | uAbsDeadline = UINT64_MAX;
|
---|
| 263 | }
|
---|
| 264 | else
|
---|
| 265 | {
|
---|
| 266 | if (fFlags & RTSEMWAIT_FLAGS_NANOSECS)
|
---|
| 267 | uTimeout = uTimeout < UINT64_MAX - UINT32_C(1000000) / 2
|
---|
| 268 | ? (uTimeout + UINT32_C(1000000) / 2) / UINT32_C(1000000)
|
---|
| 269 | : UINT64_MAX / UINT32_C(1000000);
|
---|
| 270 | if (fFlags & RTSEMWAIT_FLAGS_ABSOLUTE)
|
---|
| 271 | {
|
---|
| 272 | uAbsDeadline = uTimeout;
|
---|
| 273 | uint64_t u64Now = RTTimeSystemMilliTS();
|
---|
| 274 | if (u64Now < uTimeout)
|
---|
| 275 | uTimeout -= u64Now;
|
---|
| 276 | else
|
---|
| 277 | uTimeout = 0;
|
---|
| 278 | }
|
---|
| 279 | else if (fFlags & RTSEMWAIT_FLAGS_RESUME)
|
---|
| 280 | uAbsDeadline = RTTimeSystemMilliTS() + uTimeout;
|
---|
| 281 | else
|
---|
| 282 | uAbsDeadline = UINT64_MAX;
|
---|
| 283 |
|
---|
| 284 | dwMsTimeout = uTimeout < UINT32_MAX
|
---|
| 285 | ? (DWORD)uTimeout
|
---|
| 286 | : INFINITE;
|
---|
| 287 | }
|
---|
| 288 |
|
---|
| 289 | /*
|
---|
| 290 | * Do the wait.
|
---|
| 291 | */
|
---|
| 292 | DWORD rc;
|
---|
[25654] | 293 | #ifdef RTSEMEVENT_STRICT
|
---|
| 294 | RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt();
|
---|
| 295 | if (pThis->fEverHadSignallers)
|
---|
| 296 | {
|
---|
[32970] | 297 | do
|
---|
| 298 | rc = WaitForSingleObjectEx(pThis->hev, 0 /*Timeout*/, TRUE /*fAlertable*/);
|
---|
| 299 | while (rc == WAIT_IO_COMPLETION && (fFlags & RTSEMWAIT_FLAGS_RESUME));
|
---|
| 300 | if (rc != WAIT_TIMEOUT || dwMsTimeout == 0)
|
---|
| 301 | return rtSemEventWaitHandleStatus(pThis, fFlags, rc);
|
---|
[25654] | 302 | int rc9 = RTLockValidatorRecSharedCheckBlocking(&pThis->Signallers, hThreadSelf, pSrcPos, false,
|
---|
[32970] | 303 | dwMsTimeout, RTTHREADSTATE_EVENT_MULTI, true);
|
---|
[25654] | 304 | if (RT_FAILURE(rc9))
|
---|
| 305 | return rc9;
|
---|
| 306 | }
|
---|
| 307 | #else
|
---|
| 308 | RTTHREAD hThreadSelf = RTThreadSelf();
|
---|
[62592] | 309 | RT_NOREF_PV(pSrcPos);
|
---|
[25654] | 310 | #endif
|
---|
| 311 | RTThreadBlocking(hThreadSelf, RTTHREADSTATE_EVENT_MULTI, true);
|
---|
[32970] | 312 | rc = WaitForSingleObjectEx(pThis->hev, dwMsTimeout, TRUE /*fAlertable*/);
|
---|
| 313 | if (rc == WAIT_IO_COMPLETION && (fFlags & RTSEMWAIT_FLAGS_RESUME))
|
---|
| 314 | {
|
---|
| 315 | while ( rc == WAIT_IO_COMPLETION
|
---|
| 316 | && RTTimeSystemMilliTS() < uAbsDeadline)
|
---|
| 317 | rc = WaitForSingleObjectEx(pThis->hev, dwMsTimeout, TRUE /*fAlertable*/);
|
---|
| 318 |
|
---|
| 319 | }
|
---|
[25654] | 320 | RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_EVENT_MULTI);
|
---|
[32970] | 321 | return rtSemEventWaitHandleStatus(pThis, fFlags, rc);
|
---|
[1] | 322 | }
|
---|
| 323 |
|
---|
[25640] | 324 |
|
---|
[32970] | 325 |
|
---|
| 326 | #undef RTSemEventMultiWaitEx
|
---|
| 327 | RTDECL(int) RTSemEventMultiWaitEx(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout)
|
---|
| 328 | {
|
---|
| 329 | #ifndef RTSEMEVENT_STRICT
|
---|
| 330 | return rtSemEventMultiWinWait(hEventMultiSem, fFlags, uTimeout, NULL);
|
---|
| 331 | #else
|
---|
| 332 | RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
|
---|
| 333 | return rtSemEventMultiWinWait(hEventMultiSem, fFlags, uTimeout, &SrcPos);
|
---|
| 334 | #endif
|
---|
| 335 | }
|
---|
| 336 |
|
---|
| 337 |
|
---|
| 338 | RTDECL(int) RTSemEventMultiWaitExDebug(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout,
|
---|
| 339 | RTHCUINTPTR uId, RT_SRC_POS_DECL)
|
---|
| 340 | {
|
---|
| 341 | RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
|
---|
| 342 | return rtSemEventMultiWinWait(hEventMultiSem, fFlags, uTimeout, &SrcPos);
|
---|
| 343 | }
|
---|
| 344 |
|
---|
| 345 |
|
---|
| 346 |
|
---|
[25640] | 347 | RTDECL(void) RTSemEventMultiSetSignaller(RTSEMEVENTMULTI hEventMultiSem, RTTHREAD hThread)
|
---|
| 348 | {
|
---|
[25654] | 349 | #ifdef RTSEMEVENT_STRICT
|
---|
| 350 | struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
|
---|
| 351 | AssertPtrReturnVoid(pThis);
|
---|
| 352 | AssertReturnVoid(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC);
|
---|
| 353 |
|
---|
| 354 | ASMAtomicWriteBool(&pThis->fEverHadSignallers, true);
|
---|
| 355 | RTLockValidatorRecSharedResetOwner(&pThis->Signallers, hThread, NULL);
|
---|
[62592] | 356 | #else
|
---|
| 357 | RT_NOREF_PV(hEventMultiSem); RT_NOREF_PV(hThread);
|
---|
[25654] | 358 | #endif
|
---|
[25640] | 359 | }
|
---|
| 360 |
|
---|
| 361 |
|
---|
| 362 | RTDECL(void) RTSemEventMultiAddSignaller(RTSEMEVENTMULTI hEventMultiSem, RTTHREAD hThread)
|
---|
| 363 | {
|
---|
[25654] | 364 | #ifdef RTSEMEVENT_STRICT
|
---|
| 365 | struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
|
---|
| 366 | AssertPtrReturnVoid(pThis);
|
---|
| 367 | AssertReturnVoid(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC);
|
---|
| 368 |
|
---|
| 369 | ASMAtomicWriteBool(&pThis->fEverHadSignallers, true);
|
---|
| 370 | RTLockValidatorRecSharedAddOwner(&pThis->Signallers, hThread, NULL);
|
---|
[62592] | 371 | #else
|
---|
| 372 | RT_NOREF_PV(hEventMultiSem); RT_NOREF_PV(hThread);
|
---|
[25654] | 373 | #endif
|
---|
[25640] | 374 | }
|
---|
| 375 |
|
---|
| 376 |
|
---|
| 377 | RTDECL(void) RTSemEventMultiRemoveSignaller(RTSEMEVENTMULTI hEventMultiSem, RTTHREAD hThread)
|
---|
| 378 | {
|
---|
[25654] | 379 | #ifdef RTSEMEVENT_STRICT
|
---|
| 380 | struct RTSEMEVENTMULTIINTERNAL *pThis = hEventMultiSem;
|
---|
| 381 | AssertPtrReturnVoid(pThis);
|
---|
| 382 | AssertReturnVoid(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC);
|
---|
| 383 |
|
---|
| 384 | RTLockValidatorRecSharedRemoveOwner(&pThis->Signallers, hThread);
|
---|
[62592] | 385 | #else
|
---|
| 386 | RT_NOREF_PV(hEventMultiSem); RT_NOREF_PV(hThread);
|
---|
[25654] | 387 | #endif
|
---|
[25640] | 388 | }
|
---|
| 389 |
|
---|