| 135 | } |
| 136 | |
| 137 | BgFetchState * |
| 138 | getStateByName(const String &space) |
| 139 | { |
| 140 | BgFetchState *state; |
| 141 | std::map<String, BgFetchState *>::iterator it; |
| 142 | |
| 143 | TSMutexLock(_prefetchStates->_lock); |
| 144 | it = _prefetchStates->_states.find(space); |
| 145 | if (it != _prefetchStates->_states.end()) { |
| 146 | state = it->second; |
| 147 | } else { |
| 148 | state = new BgFetchState(); |
| 149 | _prefetchStates->_states[space] = state; |
| 150 | } |
| 151 | TSMutexUnlock(_prefetchStates->_lock); |
| 152 | return state; |
| 153 | } |
| 154 | |
| 155 | private: |
| 156 | BgFetchStates() : _lock(TSMutexCreate()) {} |
no test coverage detected