VirtualBox

Ignore:
Timestamp:
Dec 9, 2010 5:19:27 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68730
Message:

crOpenGL: fix d3d8/9 on windows xp guests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/load.c

    r34887 r34912  
    387387    if (RTThreadGetState(stub.hSyncThread)!=RTTHREADSTATE_TERMINATED)
    388388    {
     389        HANDLE hNative;
     390        DWORD ec=0;
     391
     392        hNative = OpenThread(SYNCHRONIZE|THREAD_QUERY_INFORMATION|THREAD_TERMINATE,
     393                             false, RTThreadGetNative(stub.hSyncThread));
     394        if (!hNative)
     395        {
     396            crWarning("Failed to get handle for sync thread(%#x)", GetLastError());
     397        }
     398        else
     399        {
     400            crDebug("Got handle %p for thread %#x", hNative, RTThreadGetNative(stub.hSyncThread));
     401        }
     402
    389403        ASMAtomicWriteBool(&stub.bShutdownSyncThread, true);
     404
    390405        if (PostThreadMessage(RTThreadGetNative(stub.hSyncThread), WM_QUIT, 0, 0))
    391406        {
    392407            RTThreadWait(stub.hSyncThread, 1000, NULL);
     408
     409            /*Same issue as on linux, RTThreadWait exits before system thread is terminated, which leads
     410             * to issues as our dll goes to be unloaded.
     411             *@todo
     412             *We usually call this function from DllMain which seems to be holding some lock and thus we have to
     413             * kill thread via TerminateThread.
     414             */
     415            if (WaitForSingleObject(hNative, 100)==WAIT_TIMEOUT)
     416            {
     417                crDebug("Wait failed, terminating");
     418                if (!TerminateThread(hNative, 1))
     419                {
     420                    crDebug("TerminateThread failed");
     421                }
     422            }
     423            if (GetExitCodeThread(hNative, &ec))
     424            {
     425                crDebug("Thread %p exited with ec=%i", hNative, ec);
     426            }
     427            else
     428            {
     429                crDebug("GetExitCodeThread failed(%#x)", GetLastError());
     430            }
    393431        }
    394432        else
    395433        {
    396434            crDebug("Sync thread killed before DLL_PROCESS_DETACH");
     435        }
     436
     437        if (hNative)
     438        {
     439            CloseHandle(hNative);
    397440        }
    398441    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette