Rev 1392 | Rev 1463 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1392 | Rev 1443 | ||
---|---|---|---|
Line 118... | Line 118... | ||
118 | async_call_t *call; |
118 | async_call_t *call; |
119 | ipc_callid_t callid; |
119 | ipc_callid_t callid; |
120 | 120 | ||
121 | call = malloc(sizeof(*call)); |
121 | call = malloc(sizeof(*call)); |
122 | if (!call) { |
122 | if (!call) { |
- | 123 | if (callback) |
|
123 | callback(private, ENOMEM, NULL); |
124 | callback(private, ENOMEM, NULL); |
124 | return; |
125 | return; |
125 | } |
126 | } |
126 | 127 | ||
127 | callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2); |
128 | callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2); |
128 | if (callid == IPC_CALLRET_FATAL) { |
129 | if (callid == IPC_CALLRET_FATAL) { |
129 | /* Call asynchronous handler with error code */ |
130 | /* Call asynchronous handler with error code */ |
- | 131 | if (callback) |
|
130 | callback(private, ENOENT, NULL); |
132 | callback(private, ENOENT, NULL); |
131 | free(call); |
133 | free(call); |
132 | return; |
134 | return; |
133 | } |
135 | } |
134 | 136 | ||
135 | call->callback = callback; |
137 | call->callback = callback; |
Line 203... | Line 205... | ||
203 | break; |
205 | break; |
204 | list_remove(&call->list); |
206 | list_remove(&call->list); |
205 | 207 | ||
206 | if (callid == IPC_CALLRET_FATAL) { |
208 | if (callid == IPC_CALLRET_FATAL) { |
207 | futex_up(&ipc_futex); |
209 | futex_up(&ipc_futex); |
- | 210 | if (call->callback) |
|
208 | call->callback(call->private, ENOENT, NULL); |
211 | call->callback(call->private, ENOENT, NULL); |
209 | free(call); |
212 | free(call); |
210 | futex_down(&ipc_futex); |
213 | futex_down(&ipc_futex); |
211 | } else { |
214 | } else { |
212 | call->u.callid = callid; |
215 | call->u.callid = callid; |
213 | list_append(&call->list, &dispatched_calls); |
216 | list_append(&call->list, &dispatched_calls); |
Line 234... | Line 237... | ||
234 | item = item->next) { |
237 | item = item->next) { |
235 | call = list_get_instance(item, async_call_t, list); |
238 | call = list_get_instance(item, async_call_t, list); |
236 | if (call->u.callid == callid) { |
239 | if (call->u.callid == callid) { |
237 | list_remove(&call->list); |
240 | list_remove(&call->list); |
238 | futex_up(&ipc_futex); |
241 | futex_up(&ipc_futex); |
- | 242 | if (call->callback) |
|
239 | call->callback(call->private, |
243 | call->callback(call->private, |
240 | IPC_GET_RETVAL(*data), |
244 | IPC_GET_RETVAL(*data), |
241 | data); |
245 | data); |
- | 246 | free(call); |
|
242 | return; |
247 | return; |
243 | } |
248 | } |
244 | } |
249 | } |
245 | futex_up(&ipc_futex); |
250 | futex_up(&ipc_futex); |
246 | printf("Received unidentified answer: %P!!!\n", callid); |
251 | printf("Received unidentified answer: %P!!!\n", callid); |