Changes in / [91d860d:48cc66f] in mainline
- Location:
- uspace/srv/logger
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/logger/initlvl.c
r91d860d r48cc66f 67 67 68 68 log->logged_level = level; 69 refcount_up(&log->ref_counter);69 log->ref_counter++; 70 70 71 71 log_unlock(log); -
uspace/srv/logger/logger.h
r91d860d r48cc66f 41 41 #include <async.h> 42 42 #include <stdbool.h> 43 #include <refcount.h>44 43 #include <fibril_synch.h> 45 44 #include <stdio.h> … … 65 64 link_t link; 66 65 67 atomic_refcount_t ref_counter;66 size_t ref_counter; 68 67 69 68 fibril_mutex_t guard; -
uspace/srv/logger/logs.c
r91d860d r48cc66f 99 99 fibril_mutex_initialize(&result->guard); 100 100 link_initialize(&result->link); 101 refcount_init(&result->ref_counter);102 refcount_up(&result->ref_counter);103 101 result->parent = parent; 104 102 … … 127 125 list_append(&result->link, &log_list); 128 126 if (result->parent != NULL) { 129 refcount_up(&result->parent->ref_counter); 127 fibril_mutex_lock(&result->parent->guard); 128 result->parent->ref_counter++; 129 fibril_mutex_unlock(&result->parent->guard); 130 130 } 131 131 } … … 209 209 { 210 210 assert(fibril_mutex_is_locked(&log->guard)); 211 212 if (!refcount_down(&log->ref_counter)) { 213 /* We are definitely not the last ones. */ 211 assert(log->ref_counter > 0); 212 213 /* We are definitely not the last ones. */ 214 if (log->ref_counter > 1) { 215 log->ref_counter--; 214 216 fibril_mutex_unlock(&log->guard); 215 217 return; 216 218 } 217 218 219 219 220 220 /* … … 225 225 * LOCKED(list), wants to LOCK(log) 226 226 */ 227 refcount_up(&log->ref_counter);228 227 fibril_mutex_unlock(&log->guard); 229 228 … … 235 234 */ 236 235 fibril_mutex_lock(&log->guard); 237 238 if (!refcount_down(&log->ref_counter)) { 236 assert(log->ref_counter > 0); 237 log->ref_counter--; 238 239 if (log->ref_counter > 0) { 239 240 /* 240 241 * Meanwhile, someone else increased the ref counter. … … 254 255 * - destroy dest (if top-level log) 255 256 */ 257 assert(log->ref_counter == 0); 258 256 259 list_remove(&log->link); 257 260 fibril_mutex_unlock(&log_list_guard); … … 311 314 312 315 assert(fibril_mutex_is_locked(&new_log->guard)); 313 refcount_up(&new_log->ref_counter);316 new_log->ref_counter++; 314 317 315 318 logs->logs[logs->logs_count] = new_log;
Note:
See TracChangeset
for help on using the changeset viewer.
