mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 15:40:10 +01:00
core: add NM_SHUTDOWN_TIMEOUT_1500_MSEC macro
When you have an async operation, you must make sure that it is cancellable or completes in at most NM_SHUTDOWN_TIMEOUT_MAX_MSEC. But NM_SHUTDOWN_TIMEOUT_MAX_MSEC leaves it undefined how long it is. If you really want to wait for 1500msec, but also need to ensure to stay within NM_SHUTDOWN_TIMEOUT_MAX_MSEC, then use NM_SHUTDOWN_TIMEOUT_1500_MSEC. This has the semantic of guaranteeing both.
This commit is contained in:
parent
32a828080c
commit
8bb85aecda
2 changed files with 15 additions and 0 deletions
|
|
@ -34,6 +34,10 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_STATIC_ASSERT(NM_SHUTDOWN_TIMEOUT_1500_MSEC <= NM_SHUTDOWN_TIMEOUT_MAX_MSEC);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_utils_get_shared_wifi_permission:
|
||||
* @connection: the NMConnection to lookup the permission.
|
||||
|
|
|
|||
|
|
@ -121,6 +121,17 @@ NMPlatformRoutingRule *nm_ip_routing_rule_to_platform(const NMIPRoutingRule *rul
|
|||
#define NM_SHUTDOWN_TIMEOUT_MAX_MSEC 1500
|
||||
#define NM_SHUTDOWN_TIMEOUT_ADDITIONAL_MSEC 500
|
||||
|
||||
/**
|
||||
* NM_SHUTDOWN_TIMEOUT_1500_MSEC: this is just 1500 msec. The special
|
||||
* thing about the define is that you are guaranteed that this is not
|
||||
* longer than NM_SHUTDOWN_TIMEOUT_MAX_MSEC.
|
||||
* When you perform an async operation, it must either be cancellable
|
||||
* (and complete fast) or never take longer than NM_SHUTDOWN_TIMEOUT_MAX_MSEC.
|
||||
* The usage of this macro makes that relation to NM_SHUTDOWN_TIMEOUT_MAX_MSEC
|
||||
* explicit.
|
||||
*/
|
||||
#define NM_SHUTDOWN_TIMEOUT_1500_MSEC 1500
|
||||
|
||||
typedef enum {
|
||||
/* There is no watched_obj argument, and the shutdown is delayed until the user
|
||||
* explicitly calls unregister on the returned handle. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue