VirtualBox

Changeset 89424 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Jun 1, 2021 10:22:01 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144777
Message:

DrvHostAudioPulseAudioStubs: Use RTOnce to make the init thread-safe and all. bugref:9890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostAudioPulseAudioStubs.cpp

    r89422 r89424  
    324324
    325325/** Init once.   */
    326 static RTONCE g_PulseAudioInitOnce = RTONCE_INITIALIZER;
     326static RTONCE g_PulseAudioLibInitOnce = RTONCE_INITIALIZER;
    327327
    328328/** @callback_method_impl{FNRTONCE} */
    329 static DECLCALLBACK(int32_t) drvHostAudioPusleInitOnce(void *pvUser)
     329static DECLCALLBACK(int32_t) drvHostAudioPulseLibInitOnce(void *pvUser)
    330330{
    331331    RT_NOREF(pvUser);
    332332    LogFlowFunc(("\n"));
    333333
    334     RTLDRMOD hLib = NIL_RTLDRMOD;
    335     int rc = RTLdrLoadSystemEx(VBOX_PULSE_LIB, RTLDRLOAD_FLAGS_NO_UNLOAD, &hLib);
     334    RTLDRMOD hMod = NIL_RTLDRMOD;
     335    int rc = RTLdrLoadSystemEx(VBOX_PULSE_LIB, RTLDRLOAD_FLAGS_NO_UNLOAD, &hMod);
    336336    if (RT_SUCCESS(rc))
    337337    {
    338338        for (unsigned i = 0; i < RT_ELEMENTS(g_aImportedFunctions); i++)
    339339        {
    340             rc = RTLdrGetSymbol(hLib, g_aImportedFunctions[i].pszName, (void **)g_aImportedFunctions[i].pfn);
     340            rc = RTLdrGetSymbol(hMod, g_aImportedFunctions[i].pszName, (void **)g_aImportedFunctions[i].pfn);
    341341            if (RT_FAILURE(rc))
    342342            {
     
    354354 * Try to dynamically load the PulseAudio libraries.
    355355 *
    356  * @returns VBox status code
     356 * @returns VBox status code.
    357357 */
    358358int audioLoadPulseLib(void)
    359359{
    360360    LogFlowFunc(("\n"));
    361     return RTOnce(&g_PulseAudioInitOnce, drvHostAudioPusleInitOnce, NULL);
     361    return RTOnce(&g_PulseAudioLibInitOnce, drvHostAudioPulseLibInitOnce, NULL);
    362362}
    363363
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