mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-06-19 10:48:31 +02:00
Add and use DBUS_TIMEOUT_INFINITE and DBUS_TIMEOUT_USE_DEFAULT
The documentation claimed that INT_MAX (whatever that means) meant the default, but the value that has actually always been checked for is 0x7fffffff (aka INT32_MAX on the competent platforms we sadly don't restrict our portability to), so we should use that. (In practice D-Bus probably never worked on platforms where int wasn't 32 bits, though.) Reviewed-by: Will Thompson <will.thompson@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
This commit is contained in:
parent
0fa7d26c8e
commit
719ada0e22
3 changed files with 36 additions and 6 deletions
|
|
@ -3313,8 +3313,9 @@ reply_handler_timeout (void *data)
|
|||
*
|
||||
* If -1 is passed for the timeout, a sane default timeout is used. -1
|
||||
* is typically the best value for the timeout for this reason, unless
|
||||
* you want a very short or very long timeout. If INT_MAX is passed for
|
||||
* the timeout, no timeout will be set and the call will block forever.
|
||||
* you want a very short or very long timeout. If #DBUS_TIMEOUT_INFINITE is
|
||||
* passed for the timeout, no timeout will be set and the call will block
|
||||
* forever.
|
||||
*
|
||||
* @warning if the connection is disconnected or you try to send Unix
|
||||
* file descriptors on a connection that does not support them, the
|
||||
|
|
@ -3326,7 +3327,9 @@ reply_handler_timeout (void *data)
|
|||
* object, or #NULL if connection is disconnected or when you try to
|
||||
* send Unix file descriptors on a connection that does not support
|
||||
* them.
|
||||
* @param timeout_milliseconds timeout in milliseconds, -1 for default or INT_MAX for no timeout
|
||||
* @param timeout_milliseconds timeout in milliseconds, -1 (or
|
||||
* #DBUS_TIMEOUT_USE_DEFAULT) for default or #DBUS_TIMEOUT_INFINITE for no
|
||||
* timeout
|
||||
* @returns #FALSE if no memory, #TRUE otherwise.
|
||||
*
|
||||
*/
|
||||
|
|
@ -3459,7 +3462,9 @@ dbus_connection_send_with_reply (DBusConnection *connection,
|
|||
*
|
||||
* @param connection the connection
|
||||
* @param message the message to send
|
||||
* @param timeout_milliseconds timeout in milliseconds, -1 for default or INT_MAX for no timeout.
|
||||
* @param timeout_milliseconds timeout in milliseconds, -1 (or
|
||||
* #DBUS_TIMEOUT_USE_DEFAULT) for default or #DBUS_TIMEOUT_INFINITE for no
|
||||
* timeout
|
||||
* @param error return location for error message
|
||||
* @returns the message that is the reply or #NULL with an error code if the
|
||||
* function fails.
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@ static dbus_int32_t notify_user_data_slot = -1;
|
|||
* Creates a new pending reply object.
|
||||
*
|
||||
* @param connection connection where reply will arrive
|
||||
* @param timeout_milliseconds length of timeout, -1 for default, INT_MAX for no timeout
|
||||
* @param timeout_milliseconds length of timeout, -1 (or
|
||||
* #DBUS_TIMEOUT_USE_DEFAULT) for default,
|
||||
* #DBUS_TIMEOUT_INFINITE for no timeout
|
||||
* @param timeout_handler timeout handler, takes pending call as data
|
||||
* @returns a new #DBusPendingCall or #NULL if no memory.
|
||||
*/
|
||||
|
|
@ -112,7 +114,7 @@ _dbus_pending_call_new_unlocked (DBusConnection *connection,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (timeout_milliseconds != _DBUS_INT_MAX)
|
||||
if (timeout_milliseconds != DBUS_TIMEOUT_INFINITE)
|
||||
{
|
||||
timeout = _dbus_timeout_new (timeout_milliseconds,
|
||||
timeout_handler,
|
||||
|
|
@ -515,6 +517,26 @@ _dbus_pending_call_set_data_unlocked (DBusPendingCall *pending,
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def DBUS_TIMEOUT_INFINITE
|
||||
*
|
||||
* An integer constant representing an infinite timeout. This has the
|
||||
* numeric value 0x7fffffff (the largest 32-bit signed integer).
|
||||
*
|
||||
* For source compatibility with D-Bus versions earlier than 1.4.12, use
|
||||
* 0x7fffffff, or INT32_MAX (assuming your platform has it).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def DBUS_TIMEOUT_USE_DEFAULT
|
||||
*
|
||||
* An integer constant representing a request to use the default timeout.
|
||||
* This has numeric value -1.
|
||||
*
|
||||
* For source compatibility with D-Bus versions earlier than 1.4.12, use a
|
||||
* literal -1.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef DBusPendingCall
|
||||
*
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ DBUS_BEGIN_DECLS
|
|||
* @{
|
||||
*/
|
||||
|
||||
#define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff)
|
||||
#define DBUS_TIMEOUT_USE_DEFAULT (-1)
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusPendingCall* dbus_pending_call_ref (DBusPendingCall *pending);
|
||||
DBUS_EXPORT
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue