| 3217 | |
| 3218 | |
| 3219 | void 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 | |
| 3276 | bool VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb, jrd_tra* transaction) |
no test coverage detected