Changeset d4ec49e in mainline for uspace/lib/c/generic/task.c
- Timestamp:
- 2019-08-07T05:25:59Z (6 years ago)
- Children:
- 3ea98e8
- Parents:
- 55fe220
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-10-14 23:13:41)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-07 05:25:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/task.c
r55fe220 rd4ec49e 128 128 * 129 129 * @return EOK on success, else error code. 130 * @return TODO check this doesn't return EINVAL -- clash with task_wait 130 131 */ 131 132 static errno_t task_setup_wait(task_id_t id, task_wait_t *wait) 132 133 { 133 134 assert(wait->flags); 135 if (wait->flags & TASK_WAIT_BOTH) { 136 wait->flags |= (TASK_WAIT_RETVAL | TASK_WAIT_EXIT); 137 } 138 wait->tid = id; 134 139 async_exch_t *exch = taskman_exchange_begin(); 135 140 if (exch == NULL) … … 391 396 * @param retval Store return value of the task here. 392 397 * 393 * @return EOK on success, else error code. 398 * @return EOK on success 399 * @return EINVAL on lost wait TODO other error codes 394 400 */ 395 401 errno_t task_wait(task_wait_t *wait, task_exit_t *texit, int *retval) … … 397 403 errno_t rc; 398 404 async_wait_for(wait->aid, &rc); 399 400 if (rc == EOK ) {405 406 if (rc == EOK || rc == EINVAL) { 401 407 if (wait->flags & TASK_WAIT_EXIT && texit) 402 408 *texit = ipc_get_arg1(wait->result); 403 409 if (wait->flags & TASK_WAIT_RETVAL && retval) 404 410 *retval = ipc_get_arg2(wait->result); 411 412 } 413 414 if (rc == EOK) { 415 /* Is there another wait to be done? Wait for it! */ 416 int old_flags = wait->flags; 417 wait->flags = ipc_get_arg3(wait->result); 418 if (wait->flags != 0 && (old_flags & TASK_WAIT_BOTH)) { 419 rc = task_setup_wait(wait->tid, wait); 420 } 421 } else { 422 wait->flags = 0; 405 423 } 406 424
Note:
See TracChangeset
for help on using the changeset viewer.