| 436 | } |
| 437 | |
| 438 | bool WorkerAttachment::detachIdle(StableAttachmentPart* sAtt) |
| 439 | { |
| 440 | WorkerAttachment* item = NULL; |
| 441 | { // scope |
| 442 | AttSyncLockGuard attGuard(sAtt->getSync(), FB_FUNCTION); |
| 443 | |
| 444 | Attachment* att = sAtt->getHandle(); |
| 445 | if (!att || att->att_use_count > 0) |
| 446 | return false; |
| 447 | |
| 448 | item = getByName(att->att_database->dbb_filename); |
| 449 | } |
| 450 | |
| 451 | if (item) |
| 452 | { |
| 453 | MutexLockGuard guard(item->m_mutex, FB_FUNCTION); |
| 454 | |
| 455 | FB_SIZE_T pos; |
| 456 | if (item->m_idleAtts.find(sAtt, pos)) |
| 457 | item->m_idleAtts.remove(pos); |
| 458 | else |
| 459 | return false; |
| 460 | } |
| 461 | |
| 462 | FbLocalStatus status; |
| 463 | doDetach(&status, sAtt); |
| 464 | |
| 465 | return true; |
| 466 | } |
| 467 | |
| 468 | StableAttachmentPart* WorkerAttachment::doAttach(FbStatusVector* status, Database* dbb) |
| 469 | { |