MCPcopy Create free account
hub / github.com/davisking/dlib / thread_readonly

Method thread_readonly

dlib/test/read_write_mutex.cpp:119–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117 }
118
119 void thread_readonly ()
120 {
121 for (int i = 0; i < 6; ++i)
122 {
123 auto_mutex_readonly lock(m);
124 DLIB_TEST(lock.has_read_lock());
125 DLIB_TEST(!lock.has_write_lock());
126 do_readonly_stuff();
127
128 lock.lock_readonly();
129 DLIB_TEST(lock.has_read_lock());
130 DLIB_TEST(!lock.has_write_lock());
131 lock.unlock();
132 DLIB_TEST(!lock.has_read_lock());
133 DLIB_TEST(!lock.has_write_lock());
134 lock.lock_readonly();
135 DLIB_TEST(lock.has_read_lock());
136 DLIB_TEST(!lock.has_write_lock());
137 lock.lock_write();
138 DLIB_TEST(!lock.has_read_lock());
139 DLIB_TEST(lock.has_write_lock());
140 lock.lock_write();
141 DLIB_TEST(!lock.has_read_lock());
142 DLIB_TEST(lock.has_write_lock());
143 }
144
145 dlog << LINFO << "exit thread_readonly()";
146 }
147
148 void thread_readonly2 ()
149 {

Callers

nothing calls this directly

Calls 5

has_read_lockMethod · 0.80
has_write_lockMethod · 0.80
lock_writeMethod · 0.80
lock_readonlyMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected