Changeset cd7581b in Lumiera
- Timestamp:
-
2026-05-20T23:47:11Z
(4 weeks ago)
- Author:
- Ichthyostega <prg@…>
- Branches:
- dev/play, documentation, integration
- Children:
- e32eec3
- Parents:
- a4b8313
- git-author:
- Ichthyostega <prg@…> (20/05/26 21:17:59)
- git-committer:
- Ichthyostega <prg@…> (20/05/26 23:47:11)
- Message:
-
BufferProvider: investigate tricky race at thread shutdown
...even while this situation is unlikely, it needs to be considered:
A worker thread might terminate unexpectedly, due to an error;
all thread-local objects will be destroyed automatically — while the
EngineBufferManager might be processing further allocations requested
by that very thread, and dispatch them towards an already destroyed LocalMemPool
This turns out to be a nasty problem, since the whole setup was created
to allow the workers to operate independently from each other; any handshake
or registration/deregistration mechanism would require a lock of sorts,
thereby defeating the whole purpose of the setup.
The best solution I could find is to rely on a instance marker hash,
that can be checked with an atomic read prior to each dispatch of a
memory allocation. The destructor of the local pool would then be able
to disengage, by invalidating that hash.
To evaluate this solution, I developed this mechanism
as a free-standing library component, called LiveMark
-
(No files)
-