Changeset 780c8ce in mainline
- Timestamp:
- 2019-08-07T05:52:27Z (6 years ago)
- Children:
- 012dd8e
- Parents:
- 2aaccd3
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-10-22 23:09:22)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-07 05:52:27)
- Location:
- uspace/srv/taskman
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/taskman/event.c
r2aaccd3 r780c8ce 189 189 } 190 190 191 void wait_for_task(task_id_t id, int flags, ipc_callid_t callid, ipc_call_t *call) 191 void wait_for_task(task_id_t id, int flags, ipc_callid_t callid, 192 task_id_t waiter_id) 192 193 { 193 194 assert(!(flags & TASK_WAIT_BOTH) || … … 214 215 * wait. 215 216 */ 216 task_id_t waiter_id = call->in_task_id;217 217 fibril_rwlock_write_lock(&pending_wait_lock); 218 218 pending_wait_t *pr = NULL; … … 264 264 265 265 266 int task_set_retval( ipc_call_t *call)266 int task_set_retval(task_id_t sender, int retval, bool wait_for_exit) 267 267 { 268 268 int rc = EOK; 269 task_id_t id = call->in_task_id;270 269 271 270 fibril_rwlock_write_lock(&task_hash_table_lock); 272 task_t *t = task_get_by_id( id);271 task_t *t = task_get_by_id(sender); 273 272 274 273 if ((t == NULL) || (t->exit != TASK_EXIT_RUNNING)) { … … 277 276 } 278 277 279 t->retval = IPC_GET_ARG1(*call);280 t->retval_type = IPC_GET_ARG2(*call)? RVAL_SET_EXIT : RVAL_SET;278 t->retval = retval; 279 t->retval_type = wait_for_exit ? RVAL_SET_EXIT : RVAL_SET; 281 280 282 281 event_notify(t); -
uspace/srv/taskman/event.h
r2aaccd3 r780c8ce 41 41 extern int event_init(void); 42 42 43 44 // TODO unify this API for all call/connection handlers45 43 extern int event_register_listener(task_id_t, async_sess_t *); 46 extern void wait_for_task(task_id_t, int, ipc_callid_t, ipc_call_t *);47 extern int task_set_retval( ipc_call_t *);44 extern void wait_for_task(task_id_t, int, ipc_callid_t, task_id_t); 45 extern int task_set_retval(task_id_t, int, bool); 48 46 49 47 extern void task_terminated(task_id_t, exit_reason_t); -
uspace/srv/taskman/main.c
r2aaccd3 r780c8ce 27 27 */ 28 28 29 /** 30 * Locking order: 31 * - task_hash_table_lock (task.c), 32 * - pending_wait_lock (event.c), 33 * - listeners_lock (event.c). 34 * 35 * @addtogroup taskman 36 * @{ 37 */ 38 29 39 #include <adt/prodcons.h> 30 40 #include <assert.h> … … 113 123 MERGE_LOUP32(IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall)); 114 124 int flags = IPC_GET_ARG3(*icall); 115 116 wait_for_task(id, flags, iid, icall); 125 task_id_t waiter_id = icall->in_task_id; 126 127 wait_for_task(id, flags, iid, waiter_id); 117 128 } 118 129 … … 120 131 { 121 132 printf("%s:%i from %llu\n", __func__, __LINE__, icall->in_task_id); 122 int rc = task_set_retval(icall); 133 task_id_t sender = icall->in_task_id; 134 int retval = IPC_GET_ARG1(*icall); 135 bool wait_for_exit = IPC_GET_ARG2(*icall); 136 137 int rc = task_set_retval(sender, retval, wait_for_exit); 123 138 async_answer_0(iid, rc); 124 139 } … … 265 280 } 266 281 267 /** Build hard coded configuration */268 269 282 270 283 int main(int argc, char *argv[]) … … 313 326 return 0; 314 327 } 328 329 /** 330 * @} 331 */ -
uspace/srv/taskman/task.c
r2aaccd3 r780c8ce 27 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */30 31 /**32 * locking order: (TODO move to main?)33 * - task_hash_table_lock,34 * - pending_wait_lock.35 * - listeners_lock36 *37 * @addtogroup taskman38 * @{39 29 */ 40 30
Note:
See TracChangeset
for help on using the changeset viewer.