global: move serial counter to context

This commit is contained in:
Wim Taymans 2022-01-31 17:34:30 +01:00
parent 8698d5a548
commit 54d50b943f
2 changed files with 5 additions and 5 deletions

View file

@ -36,8 +36,6 @@
PW_LOG_TOPIC_EXTERN(log_global);
#define PW_LOG_TOPIC_DEFAULT log_global
static uint64_t serial = 0;
/** \cond */
struct impl {
struct pw_global this;
@ -122,10 +120,11 @@ error_cleanup:
SPA_EXPORT
uint64_t pw_global_get_serial(struct pw_global *global)
{
struct pw_context *context = global->context;
if (global->serial == SPA_ID_INVALID)
global->serial = serial++;
if ((uint32_t)serial == SPA_ID_INVALID)
serial++;
global->serial = context->serial++;
if ((uint32_t)context->serial == SPA_ID_INVALID)
context->serial++;
return global->serial;
}

View file

@ -424,6 +424,7 @@ struct pw_context {
struct pw_mempool *pool; /**< global memory pool */
uint64_t serial;
struct pw_map globals; /**< map of globals */
struct spa_list core_impl_list; /**< list of core_imp */