8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 02:03:04 +01:00

Fixed CORE-3632: Crash after calling fork in a process, using embedded firebird library

This commit is contained in:
alexpeshkoff 2014-12-19 15:43:20 +00:00
parent 4c4e574fe2
commit f641886ba3

View File

@ -56,11 +56,14 @@ namespace
// This helps initialize globals, needed before regular ctors run
int initDone = 0;
void child(void)
{
// turn off dtors execution in forked process
initDone = 2;
}
void allClean()
{
#ifndef DARWIN // Somewhy cleanup code is called more than once on MAC
fb_assert(initDone == 1);
#endif
if (initDone != 1)
{
return;
@ -127,6 +130,7 @@ namespace
#endif //DEBUG_INIT
initDone = 1;
int ret = pthread_atfork(NULL, NULL, child);
Firebird::MemoryPool::contextPoolInit();
}