[PATCH] msvcp120: implement _Cnd_* functions
Piotr Caban
piotr.caban at gmail.com
Mon Nov 9 07:19:31 CST 2015
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
More information about the wine-devel
mailing list