Promote domains and Cyclone library to entities
This commit adds two entity types: a "domain", which is the parent of participants and which is instantiated for each domain that has at least one participant in it; and "cyclonedds", which is a representation of the (initialized) Cyclone DDS library in the process and that is the parent of all domain entities. The handle of the latter is a compile-constant, DDS_CYCLONEDDS_HANDLE. This changes the return value from dds_get_parent when executed on a participant: it now returns the handle of the entity representing the domain the participant is attached to. Two participants in the same domain self-evidently return the same domain entity. This allows deleting all participants in a domain by calling dds_delete on the domain entity, or tearing down everything and deinitializing the library by calling dds_delete on the top-level entity. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
c6befb48a7
commit
0b12ff5cfc
23 changed files with 690 additions and 305 deletions
|
@ -25,6 +25,8 @@ DDS_EXPORT void ddsrt_fini(void);
|
|||
|
||||
DDS_EXPORT ddsrt_mutex_t *ddsrt_get_singleton_mutex(void);
|
||||
|
||||
DDS_EXPORT ddsrt_cond_t *ddsrt_get_singleton_cond(void);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,7 @@ extern void ddsrt_time_fini(void);
|
|||
#define INIT_STATUS_OK 0x80000000u
|
||||
static ddsrt_atomic_uint32_t init_status = DDSRT_ATOMIC_UINT32_INIT(0);
|
||||
static ddsrt_mutex_t init_mutex;
|
||||
static ddsrt_cond_t init_cond;
|
||||
|
||||
void ddsrt_init (void)
|
||||
{
|
||||
|
@ -38,6 +39,7 @@ retry:
|
|||
return;
|
||||
else if (v == 1) {
|
||||
ddsrt_mutex_init(&init_mutex);
|
||||
ddsrt_cond_init(&init_cond);
|
||||
#if _WIN32
|
||||
ddsrt_winsock_init();
|
||||
ddsrt_time_init();
|
||||
|
@ -67,6 +69,7 @@ void ddsrt_fini (void)
|
|||
} while (!ddsrt_atomic_cas32(&init_status, v, nv));
|
||||
if (nv == 1)
|
||||
{
|
||||
ddsrt_cond_destroy(&init_cond);
|
||||
ddsrt_mutex_destroy(&init_mutex);
|
||||
ddsrt_random_fini();
|
||||
ddsrt_atomics_fini();
|
||||
|
@ -83,6 +86,11 @@ ddsrt_mutex_t *ddsrt_get_singleton_mutex(void)
|
|||
return &init_mutex;
|
||||
}
|
||||
|
||||
ddsrt_cond_t *ddsrt_get_singleton_cond(void)
|
||||
{
|
||||
return &init_cond;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "dds/ddsrt/threads.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue