src/GLX/libglxmapping.c
void __glXMappingTeardown(Bool doReset)
{

    if (doReset) {
        __GLXdisplayInfoHash *dpyInfoEntry, *dpyInfoTmp;

        /*
         * If we're just doing fork recovery, we don't actually want to unload
         * any currently loaded vendors _or_ remove any mappings (they should
         * still be valid in the new process, and may be needed if the child
         * tries using pointers/XIDs that were created in the parent).  Just
         * reset the corresponding locks.
         */
        __glvndPthreadFuncs.rwlock_init(&__glXDispatchIndexHash.lock, NULL);
        __glvndPthreadFuncs.rwlock_init(&fbconfigHashtable.lock, NULL);
        __glvndPthreadFuncs.rwlock_init(&__glXVendorNameHash.lock, NULL);
        __glvndPthreadFuncs.rwlock_init(&__glXDisplayInfoHash.lock, NULL);

        HASH_ITER(hh, _LH(__glXDisplayInfoHash), dpyInfoEntry, dpyInfoTmp) {
            __glvndPthreadFuncs.rwlock_init(&dpyInfoEntry->info.xidVendorHash.lock, NULL);
            __glvndPthreadFuncs.rwlock_init(&dpyInfoEntry->info.vendorLock, NULL);
        }
    } else {
        /* Tear down all hashtables used in this file */
        LKDHASH_TEARDOWN(__GLXdispatchIndexHash,
                         __glXDispatchIndexHash, CleanupDispatchIndexEntry,
                         NULL, False);

        LKDHASH_WRLOCK(__glXDispatchIndexHash);
        __glXNextUnusedHashIndex = 0;
        LKDHASH_UNLOCK(__glXDispatchIndexHash);

        LKDHASH_TEARDOWN(__GLXvendorConfigMappingHash,
                         fbconfigHashtable, NULL, NULL, False);

        LKDHASH_TEARDOWN(__GLXdisplayInfoHash,
                         __glXDisplayInfoHash, CleanupDisplayInfoEntry,
                         NULL, False);
        /*
         * This implicitly unloads vendor libraries that were loaded when
         * they were added to this hashtable.
         */
        LKDHASH_TEARDOWN(__GLXvendorNameHash,
                         __glXVendorNameHash, CleanupVendorNameEntry,
                         NULL, False);

        /* Free any generated entrypoints */
        glvndFreeEntrypoints();
    }

}
/*!
 * This handles freeing all mapping state during library teardown
 * or resetting locks on fork recovery.
 */
This handles freeing all mapping state during library teardown
or resetting locks on fork recovery.
This handles freeing all mapping state during library teardown or resetting locks on fork recovery .
void __glXMappingTeardown(Bool doReset)
{
    if (doReset) {
        __GLXdisplayInfoHash *dpyInfoEntry, *dpyInfoTmp;
        __glvndPthreadFuncs.rwlock_init(&__glXDispatchIndexHash.lock, NULL);
        __glvndPthreadFuncs.rwlock_init(&fbconfigHashtable.lock, NULL);
        __glvndPthreadFuncs.rwlock_init(&__glXVendorNameHash.lock, NULL);
        __glvndPthreadFuncs.rwlock_init(&__glXDisplayInfoHash.lock, NULL);
        HASH_ITER(hh, _LH(__glXDisplayInfoHash), dpyInfoEntry, dpyInfoTmp) {
            __glvndPthreadFuncs.rwlock_init(&dpyInfoEntry->info.xidVendorHash.lock, NULL);
            __glvndPthreadFuncs.rwlock_init(&dpyInfoEntry->info.vendorLock, NULL);
        }
    } else {
        LKDHASH_TEARDOWN(__GLXdispatchIndexHash,
                         __glXDispatchIndexHash, CleanupDispatchIndexEntry,
                         NULL, False);
        LKDHASH_WRLOCK(__glXDispatchIndexHash);
        __glXNextUnusedHashIndex = 0;
        LKDHASH_UNLOCK(__glXDispatchIndexHash);
        LKDHASH_TEARDOWN(__GLXvendorConfigMappingHash,
                         fbconfigHashtable, NULL, NULL, False);
        LKDHASH_TEARDOWN(__GLXdisplayInfoHash,
                         __glXDisplayInfoHash, CleanupDisplayInfoEntry,
                         NULL, False);
        LKDHASH_TEARDOWN(__GLXvendorNameHash,
                         __glXVendorNameHash, CleanupVendorNameEntry,
                         NULL, False);
        glvndFreeEntrypoints();
    }
}
void __glXMappingTeardown ( Bool doReset ) { if ( doReset ) { __GLXdisplayInfoHash * dpyInfoEntry , * dpyInfoTmp ; __glvndPthreadFuncs . rwlock_init ( & __glXDispatchIndexHash . lock , NULL ) ; __glvndPthreadFuncs . rwlock_init ( & fbconfigHashtable . lock , NULL ) ; __glvndPthreadFuncs . rwlock_init ( & __glXVendorNameHash . lock , NULL ) ; __glvndPthreadFuncs . rwlock_init ( & __glXDisplayInfoHash . lock , NULL ) ; HASH_ITER ( hh , _LH ( __glXDisplayInfoHash ) , dpyInfoEntry , dpyInfoTmp ) { __glvndPthreadFuncs . rwlock_init ( & dpyInfoEntry -> info . xidVendorHash . lock , NULL ) ; __glvndPthreadFuncs . rwlock_init ( & dpyInfoEntry -> info . vendorLock , NULL ) ; } } else { LKDHASH_TEARDOWN ( __GLXdispatchIndexHash , __glXDispatchIndexHash , CleanupDispatchIndexEntry , NULL , False ) ; LKDHASH_WRLOCK ( __glXDispatchIndexHash ) ; __glXNextUnusedHashIndex = 0 ; LKDHASH_UNLOCK ( __glXDispatchIndexHash ) ; LKDHASH_TEARDOWN ( __GLXvendorConfigMappingHash , fbconfigHashtable , NULL , NULL , False ) ; LKDHASH_TEARDOWN ( __GLXdisplayInfoHash , __glXDisplayInfoHash , CleanupDisplayInfoEntry , NULL , False ) ; LKDHASH_TEARDOWN ( __GLXvendorNameHash , __glXVendorNameHash , CleanupVendorNameEntry , NULL , False ) ; glvndFreeEntrypoints ( ) ; } }
This handles freeing all mapping state during library teardown
 or resetting locks on fork recovery.
This handles freeing all mapping state during library teardown or resetting locks on fork recovery .
/*
         * If we're just doing fork recovery, we don't actually want to unload
         * any currently loaded vendors _or_ remove any mappings (they should
         * still be valid in the new process, and may be needed if the child
         * tries using pointers/XIDs that were created in the parent).  Just
         * reset the corresponding locks.
         */ /* Tear down all hashtables used in this file */ /*
         * This implicitly unloads vendor libraries that were loaded when
         * they were added to this hashtable.
         */ /* Free any generated entrypoints */