Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Memory manager is not thread safe #10

Open
csjall opened this issue Dec 5, 2018 · 1 comment
Open

Memory manager is not thread safe #10

csjall opened this issue Dec 5, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@csjall
Copy link

csjall commented Dec 5, 2018

Currently there is no synchronization that prevents me from reading/writing/disposing a buffer at the same time from multiple threads. This could lead to race conditions where we crash or get corrupt data based on timing of the system. We should add some synchronization primitives to have atomic read/write/dispose methods.

@ryanpoulos
Copy link
Owner

Even though we discussed this in person, I'll reiterate what we decided here:

The current classes (Pointer, Pointer.Internal, and Pointer.External) are not thread safe on purpose, as I believe adding a mutex lock to every read/write would add unnecessary overhead for applications where thread safety is not a concern. I don't want to reduce performance just to cover a specific use case. With that said, I do believe it would be beneficial to add a new class called ProtectedPointer, or something like that, that does use a mutex internally to ensure thread safety.

@ryanpoulos ryanpoulos self-assigned this Dec 10, 2018
@ryanpoulos ryanpoulos added the enhancement New feature or request label Dec 10, 2018
ryanpoulos pushed a commit that referenced this issue Jan 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants