Changeset 95838f1 in mainline for uspace/lib/c/generic/async
- Timestamp:
- 2018-06-25T21:45:15Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 38e34273
- Parents:
- 3679f51a
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-25 20:58:01)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-25 21:45:15)
- Location:
- uspace/lib/c/generic/async
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async/client.c
r3679f51a r95838f1 243 243 assert(arg); 244 244 245 futex_ down(&async_futex);245 futex_lock(&async_futex); 246 246 247 247 amsg_t *msg = (amsg_t *) arg; … … 268 268 } 269 269 270 futex_u p(&async_futex);270 futex_unlock(&async_futex); 271 271 } 272 272 … … 357 357 amsg_t *msg = (amsg_t *) amsgid; 358 358 359 futex_ down(&async_futex);359 futex_lock(&async_futex); 360 360 361 361 assert(!msg->forget); … … 363 363 364 364 if (msg->done) { 365 futex_u p(&async_futex);365 futex_unlock(&async_futex); 366 366 goto done; 367 367 } … … 403 403 amsg_t *msg = (amsg_t *) amsgid; 404 404 405 futex_ down(&async_futex);405 futex_lock(&async_futex); 406 406 407 407 assert(!msg->forget); … … 409 409 410 410 if (msg->done) { 411 futex_u p(&async_futex);411 futex_unlock(&async_futex); 412 412 goto done; 413 413 } … … 477 477 assert(!msg->destroyed); 478 478 479 futex_ down(&async_futex);479 futex_lock(&async_futex); 480 480 481 481 if (msg->done) { … … 486 486 } 487 487 488 futex_u p(&async_futex);488 futex_unlock(&async_futex); 489 489 } 490 490 … … 506 506 tv_add_diff(&awaiter.to_event.expires, timeout); 507 507 508 futex_ down(&async_futex);508 futex_lock(&async_futex); 509 509 510 510 async_insert_timeout(&awaiter); -
uspace/lib/c/generic/async/server.c
r3679f51a r95838f1 432 432 * Remove myself from the connection hash table. 433 433 */ 434 futex_ down(&async_futex);434 futex_lock(&async_futex); 435 435 hash_table_remove(&conn_hash_table, &(conn_key_t){ 436 436 .task_id = fibril_connection->in_task_id, 437 437 .phone_hash = fibril_connection->in_phone_hash 438 438 }); 439 futex_u p(&async_futex);439 futex_unlock(&async_futex); 440 440 441 441 /* … … 520 520 /* Add connection to the connection hash table */ 521 521 522 futex_ down(&async_futex);522 futex_lock(&async_futex); 523 523 hash_table_insert(&conn_hash_table, &conn->link); 524 futex_u p(&async_futex);524 futex_unlock(&async_futex); 525 525 526 526 fibril_add_ready(conn->wdata.fid); … … 648 648 assert(call); 649 649 650 futex_ down(&async_futex);650 futex_lock(&async_futex); 651 651 652 652 ht_link_t *link = hash_table_find(&conn_hash_table, &(conn_key_t){ … … 655 655 }); 656 656 if (!link) { 657 futex_u p(&async_futex);657 futex_unlock(&async_futex); 658 658 return false; 659 659 } … … 663 663 msg_t *msg = malloc(sizeof(*msg)); 664 664 if (!msg) { 665 futex_u p(&async_futex);665 futex_unlock(&async_futex); 666 666 return false; 667 667 } … … 687 687 } 688 688 689 futex_u p(&async_futex);689 futex_unlock(&async_futex); 690 690 return true; 691 691 } … … 962 962 connection_t *conn = fibril_connection; 963 963 964 futex_ down(&async_futex);964 futex_lock(&async_futex); 965 965 966 966 if (usecs) { … … 982 982 memset(call, 0, sizeof(ipc_call_t)); 983 983 IPC_SET_IMETHOD(*call, IPC_M_PHONE_HUNGUP); 984 futex_u p(&async_futex);984 futex_unlock(&async_futex); 985 985 return conn->close_chandle; 986 986 } … … 1003 1003 * Get it again. 1004 1004 */ 1005 futex_ down(&async_futex);1005 futex_lock(&async_futex); 1006 1006 if ((usecs) && (conn->wdata.to_event.occurred) && 1007 1007 (list_empty(&conn->msg_queue))) { 1008 1008 /* If we timed out -> exit */ 1009 futex_u p(&async_futex);1009 futex_unlock(&async_futex); 1010 1010 return CAP_NIL; 1011 1011 } … … 1020 1020 free(msg); 1021 1021 1022 futex_u p(&async_futex);1022 futex_unlock(&async_futex); 1023 1023 return chandle; 1024 1024 } … … 1106 1106 getuptime(&tv); 1107 1107 1108 futex_ down(&async_futex);1108 futex_lock(&async_futex); 1109 1109 1110 1110 link_t *cur = list_first(&timeout_list); … … 1132 1132 } 1133 1133 1134 futex_u p(&async_futex);1134 futex_unlock(&async_futex); 1135 1135 } 1136 1136 … … 1144 1144 while (true) { 1145 1145 if (fibril_switch(FIBRIL_FROM_MANAGER)) { 1146 futex_u p(&async_futex);1146 futex_unlock(&async_futex); 1147 1147 /* 1148 1148 * async_futex is always held when entering a manager … … 1152 1152 } 1153 1153 1154 futex_ down(&async_futex);1154 futex_lock(&async_futex); 1155 1155 1156 1156 suseconds_t timeout; … … 1164 1164 1165 1165 if (tv_gteq(&tv, &waiter->to_event.expires)) { 1166 futex_u p(&async_futex);1166 futex_unlock(&async_futex); 1167 1167 handle_expired_timeouts(); 1168 1168 /* … … 1182 1182 timeout = tv_sub_diff(&waiter->to_event.expires, 1183 1183 &tv); 1184 futex_u p(&async_futex);1184 futex_unlock(&async_futex); 1185 1185 } 1186 1186 } else { 1187 futex_u p(&async_futex);1187 futex_unlock(&async_futex); 1188 1188 timeout = SYNCH_NO_TIMEOUT; 1189 1189 } … … 1226 1226 static errno_t async_manager_fibril(void *arg) 1227 1227 { 1228 futex_u p(&async_futex);1228 futex_unlock(&async_futex); 1229 1229 1230 1230 /* … … 1887 1887 _Noreturn void async_manager(void) 1888 1888 { 1889 futex_ down(&async_futex);1889 futex_lock(&async_futex); 1890 1890 fibril_switch(FIBRIL_FROM_DEAD); 1891 1891 __builtin_unreachable();
Note:
See TracChangeset
for help on using the changeset viewer.