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

[CGraph] Is the library threadsafe for readonly access? #1282

Open
chtenb opened this issue Sep 18, 2017 · 4 comments
Open

[CGraph] Is the library threadsafe for readonly access? #1282

chtenb opened this issue Sep 18, 2017 · 4 comments

Comments

@chtenb
Copy link
Contributor

chtenb commented Sep 18, 2017

It is stated in the CGraph manual that the library is not threadsafe. To what extent is this true?

Suppose a graph structure has been created. If then multiple threads are accessing this graph, but without making any modifications to the graph, would this give any problems?

@magneticnorth
Copy link
Collaborator

magneticnorth commented Sep 18, 2017 via email

@chtenb
Copy link
Contributor Author

chtenb commented Sep 18, 2017

That's a clear answer.

Is the library thread-safe if different threads only access their own graph? What if the same graphviz-context object is used across the threads for laying out the graphs?

@emden
Copy link
Collaborator

emden commented Sep 18, 2017

The problems are much more extensive. For example, many functions rely on static global or local variables, starting with the lexer and parser, including many of the layout phases and utility algorithms, and through output. To be safe, access to all of these would need to be protected by a lock or converted into explicit state data handed to the functions as an argument.

Interestingly, most of the libraries we borrowed from ast (cdt, sfio, vmalloc, etc.) are written so that they can be used in a thread-safe manner.

@magneticnorth
Copy link
Collaborator

magneticnorth commented Sep 18, 2017 via email

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