MCPcopy Create free account
hub / github.com/acl-dev/acl / unlock

Method unlock

lib_acl_cpp/src/stdlib/locker.cpp:181–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181bool locker::unlock(void)
182{
183 bool ret;
184
185#ifdef HAS_SPINLOCK
186 if (spinlock_) {
187 if (pthread_spin_unlock(spinlock_) == 0) {
188 ret = true;
189 } else {
190 ret = false;
191 }
192 } else
193#endif
194 if (mutex_) {
195 if (acl_pthread_mutex_unlock(mutex_) == 0) {
196 ret = true;
197 } else {
198 ret = false;
199 }
200 } else {
201 ret = true;
202 }
203
204 if (fHandle_ == ACL_FILE_INVALID) {
205 return ret;
206 }
207
208#ifdef ACL_HAS_FLOCK_LOCK
209 if (acl_myflock(fHandle_, ACL_FLOCK_STYLE_FLOCK, ACL_FLOCK_OP_NONE) == -1) {
210#else
211 if (acl_myflock(fHandle_, ACL_FLOCK_STYLE_FCNTL, ACL_FLOCK_OP_NONE) == -1) {
212#endif
213 return false;
214 }
215 return ret;
216}
217
218/////////////////////////////////////////////////////////////////////////////
219
220lock_guard::lock_guard(locker& lk)
221: lk_(lk)
222{
223 if (!lk_.lock()) {
224 abort();
225 }
226}
227
228lock_guard::~lock_guard(void)
229{
230 if (!lk_.unlock()) {
231 abort();
232 }
233}
234
235} // namespace acl

Callers 15

runMethod · 0.45
mainFunction · 0.45
runMethod · 0.45
mainFunction · 0.45
runMethod · 0.45
mainFunction · 0.45
runMethod · 0.45
mainFunction · 0.45
runMethod · 0.45
mainFunction · 0.45
runMethod · 0.45
rpc_req_addFunction · 0.45

Calls 2

acl_pthread_mutex_unlockFunction · 0.85
acl_myflockFunction · 0.85

Tested by

no test coverage detected