Subversion Repositories HelenOS

Rev

Rev 1364 | Rev 1568 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1364 Rev 1502
Line 140... Line 140...
140
 
140
 
141
    /* We will receive data on special box */
141
    /* We will receive data on special box */
142
    request->callerbox = &sync_box;
142
    request->callerbox = &sync_box;
143
 
143
 
144
    ipc_call(phone, request);
144
    ipc_call(phone, request);
145
    ipc_wait_for_call(&sync_box, SYNCH_NO_TIMEOUT, SYNCH_BLOCKING);
145
    ipc_wait_for_call(&sync_box, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
146
}
146
}
147
 
147
 
148
/** Answer message that was not dispatched and is not entered in
148
/** Answer message that was not dispatched and is not entered in
149
 * any queue
149
 * any queue
150
 */
150
 */
Line 303... Line 303...
303
/** Wait for phone call
303
/** Wait for phone call
304
 *
304
 *
305
 * @param box Answerbox expecting the call.
305
 * @param box Answerbox expecting the call.
306
 * @param usec Timeout in microseconds. See documentation for waitq_sleep_timeout() for
306
 * @param usec Timeout in microseconds. See documentation for waitq_sleep_timeout() for
307
 *         decription of its special meaning.
307
 *         decription of its special meaning.
308
 * @param nonblocking Blocking vs. non-blocking operation mode switch. See documentation
308
 * @param flags Select mode of sleep operation. See documentation for waitq_sleep_timeout()i
309
 *            for waitq_sleep_timeout() for description of its special meaning.
309
 *      for description of its special meaning.
310
 * @return Recived message address
310
 * @return Recived message address
311
 * - to distinguish between call and answer, look at call->flags
311
 * - to distinguish between call and answer, look at call->flags
312
 */
312
 */
313
call_t * ipc_wait_for_call(answerbox_t *box, __u32 usec, int nonblocking)
313
call_t * ipc_wait_for_call(answerbox_t *box, __u32 usec, int flags)
314
{
314
{
315
    call_t *request;
315
    call_t *request;
316
    ipl_t ipl;
316
    ipl_t ipl;
317
    int rc;
317
    int rc;
318
 
318
 
319
restart:
319
restart:
320
    rc = waitq_sleep_timeout(&box->wq, usec, nonblocking);
320
    rc = waitq_sleep_timeout(&box->wq, usec, flags);
321
    if (SYNCH_FAILED(rc))
321
    if (SYNCH_FAILED(rc))
322
        return NULL;
322
        return NULL;
323
   
323
   
324
    spinlock_lock(&box->lock);
324
    spinlock_lock(&box->lock);
325
    if (!list_empty(&box->irq_notifs)) {
325
    if (!list_empty(&box->irq_notifs)) {
Line 410... Line 410...
410
    ipc_cleanup_call_list(&task->answerbox.calls);
410
    ipc_cleanup_call_list(&task->answerbox.calls);
411
    spinlock_unlock(&task->answerbox.lock);
411
    spinlock_unlock(&task->answerbox.lock);
412
   
412
   
413
    /* Wait for all async answers to arrive */
413
    /* Wait for all async answers to arrive */
414
    while (atomic_get(&task->active_calls)) {
414
    while (atomic_get(&task->active_calls)) {
415
        call = ipc_wait_for_call(&task->answerbox, SYNCH_NO_TIMEOUT, SYNCH_BLOCKING);
415
        call = ipc_wait_for_call(&task->answerbox, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
416
        ASSERT((call->flags & IPC_CALL_ANSWERED) || (call->flags & IPC_CALL_NOTIF));
416
        ASSERT((call->flags & IPC_CALL_ANSWERED) || (call->flags & IPC_CALL_NOTIF));
417
        ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
417
        ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
418
       
418
       
419
        atomic_dec(&task->active_calls);
419
        atomic_dec(&task->active_calls);
420
        ipc_call_free(call);
420
        ipc_call_free(call);