Rev 4509 | Rev 4618 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4509 | Rev 4617 | ||
---|---|---|---|
Line 61... | Line 61... | ||
61 | 61 | ||
62 | /** Task hash table item. */ |
62 | /** Task hash table item. */ |
63 | typedef struct { |
63 | typedef struct { |
64 | link_t link; |
64 | link_t link; |
65 | task_id_t id; /**< Task ID. */ |
65 | task_id_t id; /**< Task ID. */ |
- | 66 | int retval; |
|
66 | bool destroyed; |
67 | bool destroyed; |
67 | } hashed_task_t; |
68 | } hashed_task_t; |
68 | 69 | ||
69 | /** Compute hash index into task hash table. |
70 | /** Compute hash index into task hash table. |
70 | * |
71 | * |
Line 171... | Line 172... | ||
171 | hashed_task_t *ht = hash_table_get_instance(link, hashed_task_t, link); |
172 | hashed_task_t *ht = hash_table_get_instance(link, hashed_task_t, link); |
172 | if (!ht->destroyed) |
173 | if (!ht->destroyed) |
173 | continue; |
174 | continue; |
174 | 175 | ||
175 | if (!(pr->callid & IPC_CALLID_NOTIFICATION)) |
176 | if (!(pr->callid & IPC_CALLID_NOTIFICATION)) |
176 | ipc_answer_0(pr->callid, EOK); |
177 | ipc_answer_1(pr->callid, EOK, ht->retval); |
177 | 178 | ||
178 | hash_table_remove(&task_hash_table, keys, 2); |
179 | hash_table_remove(&task_hash_table, keys, 2); |
179 | list_remove(cur); |
180 | list_remove(cur); |
180 | free(pr); |
181 | free(pr); |
181 | goto loop; |
182 | goto loop; |
Line 219... | Line 220... | ||
219 | } |
220 | } |
220 | 221 | ||
221 | link_initialize(&ht->link); |
222 | link_initialize(&ht->link); |
222 | ht->id = id; |
223 | ht->id = id; |
223 | ht->destroyed = (et == TASK_CREATE) ? false : true; |
224 | ht->destroyed = (et == TASK_CREATE) ? false : true; |
- | 225 | ht->retval = -1; |
|
224 | hash_table_insert(&task_hash_table, keys, &ht->link); |
226 | hash_table_insert(&task_hash_table, keys, &ht->link); |
225 | } else { |
227 | } else { |
226 | hashed_task_t *ht = |
228 | hashed_task_t *ht = |
227 | hash_table_get_instance(link, hashed_task_t, link); |
229 | hash_table_get_instance(link, hashed_task_t, link); |
228 | ht->destroyed = (et == TASK_CREATE) ? false : true; |
230 | ht->destroyed = (et == TASK_CREATE) ? false : true; |
Line 259... | Line 261... | ||
259 | hash_table_remove(&task_hash_table, keys, 2); |
261 | hash_table_remove(&task_hash_table, keys, 2); |
260 | retval = EOK; |
262 | retval = EOK; |
261 | 263 | ||
262 | out: |
264 | out: |
263 | if (!(callid & IPC_CALLID_NOTIFICATION)) |
265 | if (!(callid & IPC_CALLID_NOTIFICATION)) |
264 | ipc_answer_0(callid, retval); |
266 | ipc_answer_1(callid, retval, ht->retval); |
- | 267 | } |
|
- | 268 | ||
- | 269 | int ns_task_retval(ipc_call_t *call) |
|
- | 270 | { |
|
- | 271 | task_id_t id; |
|
- | 272 | unsigned long keys[2]; |
|
- | 273 | ||
- | 274 | id = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call)); |
|
- | 275 | ||
- | 276 | keys[0] = LOWER32(id); |
|
- | 277 | keys[1] = UPPER32(id); |
|
- | 278 | ||
- | 279 | link_t *link = hash_table_find(&task_hash_table, keys); |
|
- | 280 | hashed_task_t *ht = (link != NULL) ? |
|
- | 281 | hash_table_get_instance(link, hashed_task_t, link) : NULL; |
|
- | 282 | ||
- | 283 | if ((ht == NULL) || ht->destroyed) |
|
- | 284 | return EINVAL; |
|
- | 285 | ||
- | 286 | ht->retval = IPC_GET_ARG3(*call); |
|
- | 287 | ||
- | 288 | return EOK; |
|
265 | } |
289 | } |
266 | 290 | ||
267 | /** |
291 | /** |
268 | * @} |
292 | * @} |
269 | */ |
293 | */ |