Skip to content

Commit

Permalink
Fix data race in TypeObjectFactory::get_instance (#5238) (#5241)
Browse files Browse the repository at this point in the history
* Fix data race in `TypeObjectFactory::get_instance` (#5238)

* Refs #21664. Regression test.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21664. Improve synchronization in regression test.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21664. Return created instance to visualize data-race and make test fail.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21664. Just count the number of different instances.
This way we have a single final expectation.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21664. Avoid using g_instance inside the instance.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21664. Inject factory in all methods called inside `register_builtin_annotations_types`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21664. Use atomic enumeration to control the instance state.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21664. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21672. Notify condition from main thread.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21672. FIx EOL at end of file.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21672. Refactor to create builtin objects inside factory constructor.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21672. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 8f4b4a5)

# Conflicts:
#	src/cpp/dynamic-types/TypeObjectFactory.cpp

* Fix conflicts

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
mergify[bot] and MiguelCompany committed Sep 17, 2024
1 parent f5bca04 commit 1970c71
Show file tree
Hide file tree
Showing 5 changed files with 1,277 additions and 871 deletions.
Loading

0 comments on commit 1970c71

Please sign in to comment.