MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / VIO_init

Function VIO_init

src/jrd/vio.cpp:3219–3274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3217
3218
3219void VIO_init(thread_db* tdbb)
3220{
3221/**************************************
3222 *
3223 * V I O _ i n i t
3224 *
3225 **************************************
3226 *
3227 * Functional description
3228 * Activate the garbage collector thread.
3229 *
3230 **************************************/
3231 Database* dbb = tdbb->getDatabase();
3232 Jrd::Attachment* attachment = tdbb->getAttachment();
3233
3234 if (dbb->readOnly() || !(dbb->dbb_flags & DBB_gc_background))
3235 return;
3236
3237 // If there's no presence of a garbage collector running then start one up.
3238
3239 if (!(dbb->dbb_flags & DBB_garbage_collector))
3240 {
3241 const ULONG old = dbb->dbb_flags.exchangeBitOr(DBB_gc_starting);
3242 if (!(old & DBB_gc_starting))
3243 {
3244 if (old & DBB_garbage_collector)
3245 dbb->dbb_flags &= ~DBB_gc_starting;
3246 else
3247 {
3248 try
3249 {
3250 dbb->dbb_gc_fini.run(dbb);
3251 }
3252 catch (const Exception&)
3253 {
3254 dbb->dbb_flags &= ~DBB_gc_starting;
3255 ERR_bugcheck_msg("cannot start garbage collector thread");
3256 }
3257
3258 dbb->dbb_gc_init.enter();
3259 }
3260 }
3261 }
3262
3263 // Database backups and sweeps perform their own garbage collection
3264 // unless passing a no garbage collect switch which means don't
3265 // notify the garbage collector to garbage collect. Every other
3266 // attachment notifies the garbage collector to do their dirty work.
3267
3268 if ((dbb->dbb_flags & DBB_garbage_collector) &&
3269 !(attachment->att_flags & ATT_no_cleanup) &&
3270 !attachment->isGbak())
3271 {
3272 attachment->att_flags |= ATT_notify_gc;
3273 }
3274}
3275
3276bool VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb, jrd_tra* transaction)

Callers 2

internalAttachMethod · 0.85
createDatabaseMethod · 0.85

Calls 8

ERR_bugcheck_msgFunction · 0.85
getDatabaseMethod · 0.80
readOnlyMethod · 0.80
exchangeBitOrMethod · 0.80
getAttachmentMethod · 0.45
runMethod · 0.45
enterMethod · 0.45
isGbakMethod · 0.45

Tested by

no test coverage detected