GBusNameOwnerFlags: Add DO_NOT_QUEUE flag

PulseAudio and LibreOffice are among the services that use this flag.
Refusing to queue for a name lets you do this transaction,
but atomically, avoiding the transient state where you briefly join
the queue and then are given the name when its primary owner drops it:

    result = RequestName(name)

    if result == IN_QUEUE:
        ReleaseName(name)
        result = EXISTS

    return result

(Modified by Philip Withnall to add documentation.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
This commit is contained in:
Simon McVittie 2017-06-19 12:41:53 +01:00 committed by Philip Withnall
parent 92f1ba200d
commit c53b44edb2

View File

@ -952,6 +952,8 @@ typedef enum
* @G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT: Allow another message bus connection to claim the name.
* @G_BUS_NAME_OWNER_FLAGS_REPLACE: If another message bus connection owns the name and have
* specified #G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection.
* @G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE: If another message bus connection owns the name, immediately
* return an error from g_bus_own_name() rather than entering the waiting queue for that name. (Since 2.54)
*
* Flags used in g_bus_own_name().
*
@ -961,7 +963,8 @@ typedef enum
{
G_BUS_NAME_OWNER_FLAGS_NONE = 0, /*< nick=none >*/
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT = (1<<0), /*< nick=allow-replacement >*/
G_BUS_NAME_OWNER_FLAGS_REPLACE = (1<<1) /*< nick=replace >*/
G_BUS_NAME_OWNER_FLAGS_REPLACE = (1<<1), /*< nick=replace >*/
G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE = (1<<2) /*< nick=do-not-queue >*/
} GBusNameOwnerFlags;
/* When adding new flags, their numeric values must currently match those
* used in the D-Bus Specification. */