Skip to content

Commit e39ba11

Browse files
authored
Merge pull request #11491 from Tharazi97/equeue_chain_problem
Equeue chain, add documentation of using equeue_destroy
2 parents 60a8a9d + 53be630 commit e39ba11

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

TESTS/events/equeue/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,8 @@ static void test_equeue_chain()
742742
TEST_ASSERT_EQUAL_UINT8(3, touched1);
743743
TEST_ASSERT_EQUAL_UINT8(3, touched2);
744744

745-
equeue_destroy(&q1);
746745
equeue_destroy(&q2);
746+
equeue_destroy(&q1);
747747
}
748748

749749
/** Test that unchaining equeues makes them work on their own.

UNITTESTS/events/equeue/test_equeue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,8 @@ TEST_F(TestEqueue, test_equeue_chain)
765765
EXPECT_EQ(3, touched1);
766766
EXPECT_EQ(3, touched2);
767767

768-
equeue_destroy(&q1);
769768
equeue_destroy(&q2);
769+
equeue_destroy(&q1);
770770
}
771771

772772
/** Test that unchaining equeues makes them work on their own.

events/equeue.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ typedef struct equeue {
9393
//
9494
// If the event queue creation fails, equeue_create returns a negative,
9595
// platform-specific error code.
96+
//
97+
// If queues are chained, it is needed to unchain them first, before calling destroy,
98+
// or call the destroy function on queues in order that chained queues are destroyed first.
9699
int equeue_create(equeue_t *queue, size_t size);
97100
int equeue_create_inplace(equeue_t *queue, size_t size, void *buffer);
98101
void equeue_destroy(equeue_t *queue);

events/source/tests/tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,8 @@ void chain_test(void)
606606

607607
test_assert(touched == 6);
608608

609-
equeue_destroy(&q1);
610609
equeue_destroy(&q2);
610+
equeue_destroy(&q1);
611611
}
612612

613613
void unchain_test(void)

0 commit comments

Comments
 (0)