[PATCH] user32: Make functions use display dc thread-safe

Nikolay Sivov bunglehead at gmail.com
Fri Jan 12 01:56:24 CST 2018

On 1/12/2018 8:39 AM, 吕果 wrote:
> Some functions in sysparams.c invoke get_display_dc to get display dc and
>   then use it without lock mechanism. it will cause condition race in multi-thread.
> PS:
>   I dont't kown how to make a test than can stably run into this problem, but
>   call GetSystemMetrics(SM_CXSCREEN) within a tight loop in different thread
>   will get zero finally.


If the issue is get_display_dc() alone, you can use single
compare-exchange call to set static variable safely.

More information about the wine-devel mailing list