fix roundtrip cleanup code trying to delete non-existent entities
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
e040d61246
commit
098378cd89
2 changed files with 6 additions and 23 deletions
|
@ -13,7 +13,7 @@
|
||||||
/* Forward declaration */
|
/* Forward declaration */
|
||||||
|
|
||||||
static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_entity_t *readCond, dds_listener_t *listener);
|
static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_entity_t *readCond, dds_listener_t *listener);
|
||||||
static void finalize_dds(dds_entity_t participant, dds_entity_t reader, dds_entity_t readCond);
|
static void finalize_dds(dds_entity_t participant);
|
||||||
|
|
||||||
typedef struct ExampleTimeStats
|
typedef struct ExampleTimeStats
|
||||||
{
|
{
|
||||||
|
@ -402,7 +402,7 @@ done:
|
||||||
sigaction (SIGINT, &oldAction, 0);
|
sigaction (SIGINT, &oldAction, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
finalize_dds(participant, reader, readCond);
|
finalize_dds(participant);
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
exampleDeleteTimeStats (&roundTrip);
|
exampleDeleteTimeStats (&roundTrip);
|
||||||
|
@ -484,19 +484,9 @@ static dds_entity_t prepare_dds(dds_entity_t *wr, dds_entity_t *rd, dds_entity_t
|
||||||
return participant;
|
return participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finalize_dds(dds_entity_t ppant, dds_entity_t rd, dds_entity_t rdcond)
|
static void finalize_dds(dds_entity_t ppant)
|
||||||
{
|
{
|
||||||
dds_return_t status;
|
dds_return_t status;
|
||||||
|
|
||||||
/* Disable callbacks */
|
|
||||||
dds_set_enabled_status (rd, 0);
|
|
||||||
|
|
||||||
(void) dds_waitset_detach (waitSet, rdcond);
|
|
||||||
status = dds_waitset_detach (waitSet, waitSet);
|
|
||||||
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
|
||||||
(void) dds_delete (rdcond);
|
|
||||||
status = dds_delete (waitSet);
|
|
||||||
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
|
||||||
status = dds_delete (ppant);
|
status = dds_delete (ppant);
|
||||||
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ static dds_entity_t waitSet;
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_entity_t *readCond, dds_listener_t *listener);
|
static dds_entity_t prepare_dds(dds_entity_t *writer, dds_entity_t *reader, dds_entity_t *readCond, dds_listener_t *listener);
|
||||||
static void finalize_dds(dds_entity_t participant, dds_entity_t readCond, RoundTripModule_DataType data[MAX_SAMPLES]);
|
static void finalize_dds(dds_entity_t participant, RoundTripModule_DataType data[MAX_SAMPLES]);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
@ -131,23 +131,16 @@ int main (int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
finalize_dds(participant, readCond, data);
|
finalize_dds(participant, data);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finalize_dds(dds_entity_t participant, dds_entity_t readCond, RoundTripModule_DataType data[MAX_SAMPLES])
|
static void finalize_dds(dds_entity_t participant, RoundTripModule_DataType data[MAX_SAMPLES])
|
||||||
{
|
{
|
||||||
dds_return_t status;
|
dds_return_t status;
|
||||||
(void)dds_waitset_detach (waitSet, readCond);
|
|
||||||
status = dds_waitset_detach (waitSet, waitSet);
|
|
||||||
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
|
||||||
(void)dds_delete (readCond);
|
|
||||||
status = dds_delete (waitSet);
|
|
||||||
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
|
||||||
status = dds_delete (participant);
|
status = dds_delete (participant);
|
||||||
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MAX_SAMPLES; i++)
|
for (unsigned int i = 0; i < MAX_SAMPLES; i++)
|
||||||
{
|
{
|
||||||
RoundTripModule_DataType_free (&data[i], DDS_FREE_CONTENTS);
|
RoundTripModule_DataType_free (&data[i], DDS_FREE_CONTENTS);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue