!3914 修复一处插件并发加载插件问题
Merge pull request !3914 from ljy/master_fix_filescan_list
This commit is contained in:
@ -2828,6 +2828,9 @@ void PostgresInitializer::InitExtensionVariable()
|
||||
(void**)MemoryContextAllocZero(u_sess->self_mem_cxt, (Size)(initExtArraySize * sizeof(void*)));
|
||||
|
||||
DynamicFileList* file_scanner = NULL;
|
||||
AutoMutexLock libraryLock(&file_list_lock);
|
||||
libraryLock.lock();
|
||||
|
||||
for (file_scanner = file_list; file_scanner != NULL; file_scanner = file_scanner->next) {
|
||||
/*
|
||||
* If the library has a init_session_vars() function, call it for
|
||||
@ -2835,8 +2838,10 @@ void PostgresInitializer::InitExtensionVariable()
|
||||
*/
|
||||
init_session_vars = (void(*)(void))pg_dlsym(file_scanner->handle, "init_session_vars");
|
||||
if (init_session_vars != NULL)
|
||||
(*init_session_vars)();
|
||||
(*init_session_vars)(); /*It is assumed that this does not cause a deadlock for the file_list_lock*/
|
||||
}
|
||||
|
||||
libraryLock.unLock();
|
||||
|
||||
/* check whether the extension has been created
|
||||
* at most one will be true.
|
||||
|
Reference in New Issue
Block a user