|
Lines 348-354
static void _dbus_connection_update_dispatch_status_and_unlock (DB
Link Here
|
| 348 |
static void _dbus_connection_last_unref (DBusConnection *connection); |
348 |
static void _dbus_connection_last_unref (DBusConnection *connection); |
| 349 |
static void _dbus_connection_acquire_dispatch (DBusConnection *connection); |
349 |
static void _dbus_connection_acquire_dispatch (DBusConnection *connection); |
| 350 |
static void _dbus_connection_release_dispatch (DBusConnection *connection); |
350 |
static void _dbus_connection_release_dispatch (DBusConnection *connection); |
| 351 |
static DBusDispatchStatus _dbus_connection_flush_unlocked (DBusConnection *connection); |
351 |
static DBusDispatchStatus _dbus_connection_flush_unlocked (DBusConnection *connection, int timeout_milliseconds); |
| 352 |
static void _dbus_connection_close_possibly_shared_and_unlock (DBusConnection *connection); |
352 |
static void _dbus_connection_close_possibly_shared_and_unlock (DBusConnection *connection); |
| 353 |
static dbus_bool_t _dbus_connection_get_is_connected_unlocked (DBusConnection *connection); |
353 |
static dbus_bool_t _dbus_connection_get_is_connected_unlocked (DBusConnection *connection); |
| 354 |
static dbus_bool_t _dbus_connection_peek_for_reply_unlocked (DBusConnection *connection, |
354 |
static dbus_bool_t _dbus_connection_peek_for_reply_unlocked (DBusConnection *connection, |
|
Lines 2367-2373
_dbus_connection_block_pending_call (DBusPendingCall *pending)
Link Here
|
| 2367 |
DBusConnection *connection; |
2367 |
DBusConnection *connection; |
| 2368 |
dbus_uint32_t client_serial; |
2368 |
dbus_uint32_t client_serial; |
| 2369 |
DBusTimeout *timeout; |
2369 |
DBusTimeout *timeout; |
| 2370 |
int timeout_milliseconds, elapsed_milliseconds; |
2370 |
int timeout_milliseconds = -1, elapsed_milliseconds; |
| 2371 |
|
2371 |
|
| 2372 |
_dbus_assert (pending != NULL); |
2372 |
_dbus_assert (pending != NULL); |
| 2373 |
|
2373 |
|
|
Lines 2379-2385
_dbus_connection_block_pending_call (DBusPendingCall *pending)
Link Here
|
| 2379 |
connection = _dbus_pending_call_get_connection_and_lock (pending); |
2379 |
connection = _dbus_pending_call_get_connection_and_lock (pending); |
| 2380 |
|
2380 |
|
| 2381 |
/* Flush message queue - note, can affect dispatch status */ |
2381 |
/* Flush message queue - note, can affect dispatch status */ |
| 2382 |
_dbus_connection_flush_unlocked (connection); |
2382 |
|
|
|
2383 |
timeout = _dbus_pending_call_get_timeout_unlocked (pending); |
| 2384 |
if (timeout) |
| 2385 |
timeout_milliseconds = dbus_timeout_get_interval (timeout); |
| 2386 |
|
| 2387 |
_dbus_connection_flush_unlocked (connection, timeout_milliseconds); |
| 2383 |
|
2388 |
|
| 2384 |
client_serial = _dbus_pending_call_get_reply_serial_unlocked (pending); |
2389 |
client_serial = _dbus_pending_call_get_reply_serial_unlocked (pending); |
| 2385 |
|
2390 |
|
|
Lines 3555-3561
dbus_connection_send_with_reply_and_block (DBusConnection *connection,
Link Here
|
| 3555 |
* @param connection the connection. |
3560 |
* @param connection the connection. |
| 3556 |
*/ |
3561 |
*/ |
| 3557 |
static DBusDispatchStatus |
3562 |
static DBusDispatchStatus |
| 3558 |
_dbus_connection_flush_unlocked (DBusConnection *connection) |
3563 |
_dbus_connection_flush_unlocked (DBusConnection *connection, int timeout_milliseconds) |
| 3559 |
{ |
3564 |
{ |
| 3560 |
/* We have to specify DBUS_ITERATION_DO_READING here because |
3565 |
/* We have to specify DBUS_ITERATION_DO_READING here because |
| 3561 |
* otherwise we could have two apps deadlock if they are both doing |
3566 |
* otherwise we could have two apps deadlock if they are both doing |
|
Lines 3563-3582
_dbus_connection_flush_unlocked (DBusConnection *connection)
Link Here
|
| 3563 |
* dispatch status. |
3568 |
* dispatch status. |
| 3564 |
*/ |
3569 |
*/ |
| 3565 |
DBusDispatchStatus status; |
3570 |
DBusDispatchStatus status; |
|
|
3571 |
long start_tv_sec, start_tv_usec; |
| 3572 |
long tv_sec, tv_usec; |
| 3573 |
int elapsed_milliseconds = 0; |
| 3566 |
|
3574 |
|
| 3567 |
HAVE_LOCK_CHECK (connection); |
3575 |
HAVE_LOCK_CHECK (connection); |
|
|
3576 |
|
| 3577 |
_dbus_get_monotonic_time (&start_tv_sec, &start_tv_usec); |
| 3568 |
|
3578 |
|
| 3569 |
while (connection->n_outgoing > 0 && |
3579 |
while (connection->n_outgoing > 0 && |
| 3570 |
_dbus_connection_get_is_connected_unlocked (connection)) |
3580 |
_dbus_connection_get_is_connected_unlocked (connection)) |
| 3571 |
{ |
3581 |
{ |
| 3572 |
_dbus_verbose ("doing iteration in\n"); |
3582 |
_dbus_verbose ("doing iteration in\n"); |
|
|
3583 |
|
| 3584 |
if (timeout_milliseconds >= 0) |
| 3585 |
{ |
| 3586 |
_dbus_get_monotonic_time (&tv_sec, &tv_usec); |
| 3587 |
elapsed_milliseconds = (tv_sec - start_tv_sec) * 1000 + |
| 3588 |
(tv_usec - start_tv_usec) / 1000; |
| 3589 |
|
| 3590 |
if (elapsed_milliseconds >= timeout_milliseconds) |
| 3591 |
break; |
| 3592 |
} |
| 3593 |
|
| 3573 |
HAVE_LOCK_CHECK (connection); |
3594 |
HAVE_LOCK_CHECK (connection); |
| 3574 |
_dbus_connection_do_iteration_unlocked (connection, |
3595 |
_dbus_connection_do_iteration_unlocked (connection, |
| 3575 |
NULL, |
3596 |
NULL, |
| 3576 |
DBUS_ITERATION_DO_READING | |
3597 |
DBUS_ITERATION_DO_READING | |
| 3577 |
DBUS_ITERATION_DO_WRITING | |
3598 |
DBUS_ITERATION_DO_WRITING | |
| 3578 |
DBUS_ITERATION_BLOCK, |
3599 |
DBUS_ITERATION_BLOCK, |
| 3579 |
-1); |
3600 |
timeout_milliseconds - elapsed_milliseconds); |
| 3580 |
} |
3601 |
} |
| 3581 |
|
3602 |
|
| 3582 |
HAVE_LOCK_CHECK (connection); |
3603 |
HAVE_LOCK_CHECK (connection); |
|
Lines 3606-3612
dbus_connection_flush (DBusConnection *connection)
Link Here
|
| 3606 |
|
3627 |
|
| 3607 |
CONNECTION_LOCK (connection); |
3628 |
CONNECTION_LOCK (connection); |
| 3608 |
|
3629 |
|
| 3609 |
status = _dbus_connection_flush_unlocked (connection); |
3630 |
status = _dbus_connection_flush_unlocked (connection, -1); |
| 3610 |
|
3631 |
|
| 3611 |
HAVE_LOCK_CHECK (connection); |
3632 |
HAVE_LOCK_CHECK (connection); |
| 3612 |
/* Unlocks and calls out to user code */ |
3633 |
/* Unlocks and calls out to user code */ |