mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:03:02 +01:00
Fixed #7738: Crash on multiple connections/disconnections
This commit is contained in:
parent
bdce8b1341
commit
8e61e1111d
@ -1633,6 +1633,10 @@ void CCH_init2(thread_db* tdbb)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
BufferControl* bcb = dbb->dbb_bcb;
|
||||
|
||||
// Avoid running CCH_init2() in 2 parallel threads
|
||||
Firebird::MutexEnsureUnlock guard(bcb->bcb_threadStartup, FB_FUNCTION);
|
||||
guard.enter();
|
||||
|
||||
if (!(bcb->bcb_flags & BCB_exclusive) || (bcb->bcb_flags & (BCB_cache_writer | BCB_writer_start)))
|
||||
return;
|
||||
|
||||
@ -1653,6 +1657,7 @@ void CCH_init2(thread_db* tdbb)
|
||||
{
|
||||
// writer startup in progress
|
||||
bcb->bcb_flags |= BCB_writer_start;
|
||||
guard.leave();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -142,6 +142,9 @@ public:
|
||||
Firebird::SyncObject bcb_syncPrecedence;
|
||||
Firebird::SyncObject bcb_syncLRU;
|
||||
|
||||
// If we make bcb_flags atomic this mutex will become unneeded: XCHG of bcb_flags is enough
|
||||
Firebird::Mutex bcb_threadStartup;
|
||||
|
||||
typedef ThreadFinishSync<BufferControl*> BcbThreadSync;
|
||||
|
||||
static void cache_writer(BufferControl* bcb);
|
||||
|
Loading…
Reference in New Issue
Block a user