Skip to content
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

Is e4c_lite pthread safe? #5

Open
tecywiz121 opened this issue May 10, 2016 · 2 comments
Open

Is e4c_lite pthread safe? #5

tecywiz121 opened this issue May 10, 2016 · 2 comments

Comments

@tecywiz121
Copy link

I noticed that in e4c_lite.h you mark e4c as threadprivate, which looks like an OpenMP directive. Does that mean it will be safe with multiple threads even if I'm not doing anything else OpenMP related?

@gogeccc
Copy link

gogeccc commented May 11, 2016

http://guillermo.in/exceptions4c/

"Multithreading
You may also enable the thread-safe version of the library which relies on pthreads."

I'd say that this answers it.
(actually, after some reading and a little bit of snooping through the code, I am not so sure :D)

@guillermocalvo
Copy link
Owner

The lightweight version of the library does not support complex multithreading. However, OpenMP directives are safe to use; and it might as well be safe to use C11 threads if e4c was specified as _Thread_local (I haven't thoroughly tested it yet).

Anyway, if you really need pthreads then you can use the standard version of exceptions4c and define the preprocessor macro E4C_THREADSAFE so that it is compiled in thread-safe mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants