On 11/07/15 00:58, Daniel Lehman wrote:
+void __cdecl _Cnd_destroy(_Cnd_t *cnd) +{
- MSVCRT_operator_delete(*cnd);
+}
What happens when _Cnd_destroy is called while someone waits on condition variable?
+int __cdecl _Cnd_timedwait(_Cnd_t *cnd, _Mtx_t *mtx, const xtime *xt) +{
- CONDITION_VARIABLE *cv = &(*cnd)->cv;
- LARGE_INTEGER timeout;
- NTSTATUS status;
- InterlockedExchangeAdd( (LONG *)&cv->Ptr, 1 );
- _Mtx_unlock(mtx);
- timeout.QuadPart = (ULONGLONG)_Xtime_diff_to_millis(xt) * -10000;
- status = NtWaitForKeyedEvent(keyed_event, &cv->Ptr, FALSE, &timeout);
- if (status)
- {
if (!interlocked_dec_if_nonzero( (LONG *)&cv->Ptr ))
NtWaitForKeyedEvent( keyed_event, &cv->Ptr, FALSE, NULL );
You need to update status here.
Thanks, Piotr
What happens when _Cnd_destroy is called while someone waits on condition variable?
Causes a crash in later _Cnd_* calls for me on Windows (7 SP1 x64)
Thanks daniel