On Wed, May 22, 2019 at 05:16:32PM +0800, Zhiyi Zhang wrote:
Display device handlers are used to initialize the display device registry data. Different handlers can be implemented according to the defined interface, for example, via Xinerama or XRandR. With those registry data, EnumDisplayDevices, EnumDisplayMonitors and GetMonitorInfo can be built on top of it.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
v2: Supersede 162308~162314, fix xinerama primary adapter reporting, fix registry data reinit failure. v3: Rebase v4: Merge patches. Rebase. Supersede 164594~164599, 164612~164613 v5: Fix explorer patch triggered user32 test failures. Supersede 165122~165128. v6: Restructure patches. Supersede 165134~165140
Thanks, this order makes it easier to see what you're adding.
+void X11DRV_DisplayDevices_Init(void) +{
- HKEY video_hkey = NULL;
- DWORD disposition = 0;
- BOOL success = FALSE;
- TRACE("via %s\n", wine_dbgstr_a(handler.name));
- if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, video_keyW, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &video_hkey,
&disposition))
goto fail;
- /* Ensure only one thread is initializing the registry and avoid unnecessary reinit */
- if (disposition != REG_CREATED_NEW_KEY)
- {
success = TRUE;
goto fail;
- }
- success = TRUE;
+fail:
- RegCloseKey(video_hkey);
- if (!success)
ERR("Failed to initialize display devices\n");
+}
So, the second thread (or process) will just carry on. That's going to leave it racing with the first if it tries to read the registry data.
Huw.