| 102 | } |
| 103 | |
| 104 | void houseKeeping() |
| 105 | { |
| 106 | if (threads.empty()) |
| 107 | return; |
| 108 | |
| 109 | // join finished threads |
| 110 | AllThreads finished(threads.get_allocator()); |
| 111 | { // mutex scope |
| 112 | Firebird::MutexLockGuard g(threadsMutex, FB_FUNCTION); |
| 113 | |
| 114 | for (auto n = threads.begin(); n != threads.end(); ) |
| 115 | { |
| 116 | if (n->ending) |
| 117 | { |
| 118 | finished.push_back(std::move(*n)); |
| 119 | n = threads.erase(n); |
| 120 | } |
| 121 | else |
| 122 | ++n; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | waitFor(finished); |
| 127 | } |
| 128 | |
| 129 | private: |
| 130 | struct Thrd |
no test coverage detected