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

Threading support? #8

Open
desertkun opened this issue Jul 1, 2017 · 5 comments
Open

Threading support? #8

desertkun opened this issue Jul 1, 2017 · 5 comments

Comments

@desertkun
Copy link
Contributor

Considering to migrate from pyv8, but not sure if this solution allows me to fire multiple Isolates in different threads.

extern Isolate *isolate;

Does not sound like it does.

@tbodt
Copy link
Owner

tbodt commented Jul 1, 2017

Nope. There is currently one true isolate. It would probably be an API breaking change to fix that.

@tbodt
Copy link
Owner

tbodt commented Jul 1, 2017

Or not, maybe extern Isolate *isolate could simply be replaced by a thread local? That feels a little messy though.

@desertkun
Copy link
Contributor Author

I am fine with default isolate, but perhaps there should be a way to create one from python and then pass it as argument into Context or whatever structures you are using (which breaks no API). And yeah, Locker is to be introduced.

@kokhoor
Copy link

kokhoor commented Apr 15, 2019

My test indicates that multiple thread having own Context can work fine. Is v8py still running on 1 isolate?

If yes, what is potential problem when multithreading with each thread having own Context?

@desertkun
Copy link
Contributor Author

@kokhoor When I researched this I had too many issues. You'd have to lock/release the GIL in order for threading to actually work. This implies many scenarios like python->js->python calls and introducing GIL to this really explodes the complexity.

tl;dr Don't bother.

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