-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
thread safety #18
Labels
Comments
LytixDev
added
enhancement
New feature or request
question
Further information is requested
labels
Jan 31, 2023
I very much like this idea! I also suggest creating a threadpool that could be used to exemplify how useful this is. |
I believe we could use a common struct for thread safety. This struct would have a condition predicate, a lock and a condition variable. This way it could also broadcast conditions and only be in effect if the predicate is true, etc etc. struct condition_t {
bool cond_predicate;
pthread_mutex_t cond_lock;
pthread_cond_t cond_variable;
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some data structures should perhaps be thread safe?
For example the hashmap implementation should have a way to ensure it is safe to use with multiple threads.
It could be as simple as having one single mutex locking the entire hashmap. We could also have a mutex that only locks on hashmap_put.
In order to not add the overhead of thread safety when its not needed, the user should define whether or not they want the implementation to be thread safe.
The text was updated successfully, but these errors were encountered: