Changeset 35f2bb1 in mainline
- Timestamp:
- 2017-11-23T21:15:13Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 40e5d66
- Parents:
- d51a0d6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ipc.c
rd51a0d6 r35f2bb1 50 50 51 51 /** 52 * Structures of this type are used for keeping track 53 * of sent asynchronous calls and queing unsent calls. 52 * Structures of this type are used for keeping track of sent asynchronous calls. 54 53 */ 55 54 typedef struct { … … 72 71 73 72 LIST_INITIALIZE(dispatched_calls); 74 75 /** List of asynchronous calls that were not accepted by kernel.76 *77 * Protected by async_futex, because if the call is not accepted78 * by the kernel, the async framework is used automatically.79 *80 */81 LIST_INITIALIZE(queued_calls);82 73 83 74 static futex_t ipc_futex = FUTEX_INITIALIZER; … … 294 285 295 286 return __SYSCALL2(SYS_IPC_ANSWER_SLOW, callid, (sysarg_t) &data); 296 }297 298 /** Try to dispatch queued calls from the async queue.299 *300 */301 static void dispatch_queued_calls(void)302 {303 /** @todo304 * Integrate intelligently ipc_futex so that it is locked during305 * ipc_call_async_*() until it is added to dispatched_calls.306 */307 308 futex_down(&async_futex);309 310 while (!list_empty(&queued_calls)) {311 async_call_t *call =312 list_get_instance(list_first(&queued_calls), async_call_t, list);313 ipc_callid_t callid =314 ipc_call_async_internal(call->u.msg.phoneid, &call->u.msg.data);315 316 list_remove(&call->list);317 318 futex_up(&async_futex);319 320 assert(call->fid);321 fibril_add_ready(call->fid);322 323 if (callid == (ipc_callid_t) IPC_CALLRET_FATAL) {324 if (call->callback)325 call->callback(call->private, ENOENT, NULL);326 327 free(call);328 } else {329 call->u.callid = callid;330 331 futex_lock(&ipc_futex);332 list_append(&call->list, &dispatched_calls);333 futex_unlock(&ipc_futex);334 }335 336 futex_down(&async_futex);337 }338 339 futex_up(&async_futex);340 287 } 341 288 … … 400 347 401 348 /* Handle received answers */ 402 if (callid & IPC_CALLID_ANSWERED) {349 if (callid & IPC_CALLID_ANSWERED) 403 350 handle_answer(callid, call); 404 dispatch_queued_calls();405 }406 351 407 352 return callid;
Note:
See TracChangeset
for help on using the changeset viewer.