Changeset 3bd1d7d4 in mainline
- Timestamp:
- 2018-06-19T19:48:14Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7d7bc09, 8751cf3
- Parents:
- 5c76cc61
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-31 18:05:11)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-19 19:48:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async/server.c
r5c76cc61 r3bd1d7d4 240 240 } 241 241 242 static futex_t client_futex = FUTEX_INITIALIZER; 242 243 static hash_table_t client_hash_table; 243 static hash_table_t conn_hash_table;244 244 245 245 // TODO: lockfree notification_queue? … … 249 249 static FIBRIL_SEMAPHORE_INITIALIZE(notification_semaphore, 0); 250 250 251 static sysarg_t notification_avail = 0; 252 253 /* The remaining structures are guarded by async_futex. */ 254 static hash_table_t conn_hash_table; 251 255 static LIST_INITIALIZE(timeout_list); 252 253 static sysarg_t notification_avail = 0;254 256 255 257 static size_t client_key_hash(void *key) … … 339 341 client_t *client = NULL; 340 342 341 futex_ down(&async_futex);343 futex_lock(&client_futex); 342 344 ht_link_t *link = hash_table_find(&client_hash_table, &client_id); 343 345 if (link) { … … 345 347 atomic_inc(&client->refcnt); 346 348 } else if (create) { 349 // TODO: move the malloc out of critical section 347 350 client = malloc(sizeof(client_t)); 348 351 if (client) { … … 355 358 } 356 359 357 futex_u p(&async_futex);360 futex_unlock(&client_futex); 358 361 return client; 359 362 } … … 363 366 bool destroy; 364 367 365 futex_ down(&async_futex);368 futex_lock(&client_futex); 366 369 367 370 if (atomic_predec(&client->refcnt) == 0) { … … 371 374 destroy = false; 372 375 373 futex_u p(&async_futex);376 futex_unlock(&client_futex); 374 377 375 378 if (destroy) {
Note:
See TracChangeset
for help on using the changeset viewer.