Changeset 2e39656 in mainline for uspace/srv/logger/namespace.c
- Timestamp:
- 2012-07-14T17:41:01Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ceafd1b
- Parents:
- ef5be68
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/logger/namespace.c
ref5be68 r2e39656 43 43 fibril_mutex_t guard; 44 44 size_t writers_count; 45 fibril_condvar_t reader_appeared_cv; 45 46 bool has_reader; 46 47 const char *name; … … 167 168 fibril_mutex_lock(&namespace->guard); 168 169 namespace->has_reader = true; 170 fibril_condvar_broadcast(&namespace->reader_appeared_cv); 169 171 fibril_mutex_unlock(&namespace->guard); 170 172 } … … 200 202 fibril_mutex_lock(&namespace->guard); 201 203 namespace->has_reader = false; 204 fibril_condvar_broadcast(&namespace->reader_appeared_cv); 202 205 fibril_mutex_unlock(&namespace->guard); 203 206 … … 221 224 fibril_mutex_unlock(&namespace->guard); 222 225 return has_reader; 226 } 227 228 void namespace_wait_for_reader_change(logging_namespace_t *namespace, bool *has_reader_now) 229 { 230 fibril_mutex_lock(&namespace->guard); 231 bool had_reader = namespace->has_reader; 232 while (had_reader == namespace->has_reader) { 233 fibril_condvar_wait(&namespace->reader_appeared_cv, &namespace->guard); 234 } 235 *has_reader_now = namespace->has_reader; 236 fibril_mutex_unlock(&namespace->guard); 223 237 } 224 238
Note:
See TracChangeset
for help on using the changeset viewer.