Skip to content

Commit

Permalink
feat: notes on real-time applications
Browse files Browse the repository at this point in the history
  • Loading branch information
igormcoelho committed Feb 15, 2023
1 parent 5758d72 commit d93d758
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ This pointer has advantages (mostly inspired by gcpp project):
- type erased pool type (or context, or arena, or section, etc) that automatically discards all references in same pool (such as gcpp)
- ability to manually destroy/collect garbage on convenient locations (such as gcpp)
- deferred destruction by means of stored destructors and not raw memory (such as gcpp)
- **automatic destruction of objects, regardless of cycles** (not available in gcpp)
- **automatic/dynamic destruction of objects, regardless of cycles** (in gcpp only manual destruction is allowed through `collect()` method)
- **relatively simple implementation aiming cross-language support, based on tree ownership data structures** (gcpp is implemented with a completely different strategy focused on C/C++, not yet considered for other languages, as far as I know)

This pointer has disadvantages too:
Expand All @@ -213,6 +213,15 @@ This pointer has disadvantages too:
- does not support copy semantics, only move semantics and a `get_owned` method as helper
- (planned feature) no support for delegated construction of smart pointer (such as in `std::shared_ptr` two parameter constructor)

### Usage of automatic collection on real-time scenarios

`relation_pool` can disable automatic collection with `pool.setAutoCollect(false);`,
and then go back to automatic collection with `pool.setAutoCollect(true);`.
When using `setAutoCollect(true)`, it automatically invokes `collect()` method,
thus allowing real-time sections of the code to execute **fast***, and keep all pending operations to be performed after real-time sections.

(*) this is supposed to be O(1) time... must check this carefully if really needed on practice!

## Typical use cases

- developing cyclic data structures using an unified pointer type. *See [ExperimentsList.md](ExperimentsList.md) to learn more about that.*
Expand Down

0 comments on commit d93d758

Please sign in to comment.