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

GoRoutines #42

Open
iMaxopoly opened this issue Jun 27, 2016 · 3 comments
Open

GoRoutines #42

iMaxopoly opened this issue Jun 27, 2016 · 3 comments
Assignees

Comments

@iMaxopoly
Copy link

@iMaxopoly iMaxopoly commented Jun 27, 2016

This isn't goroutine safe is it?

Are you planning to add go-routine safe features if it is doable?

Thank you.

My preliminary tests crashed when I tried to access multiple URLs using go routines.

@masci
Copy link
Contributor

@masci masci commented Jun 30, 2016

Not sure what's your issue but you should take care of thread safety at the python level by yourself, ensuring to lock the GIL every time you access the CPython API, whether using go-python functionalities or cgo directly.

@sbinet sbinet self-assigned this Jul 1, 2016
@sbinet
Copy link
Owner

@sbinet sbinet commented Jul 1, 2016

(apologies for the belated answer)

No, sbinet/go-python doesn't make any promise about go-routine safety.
Neither does CPython, FTR.

That said, could you explain a bit what you were trying to do?

@iMaxopoly
Copy link
Author

@iMaxopoly iMaxopoly commented Jul 2, 2016

Hello @sbinet

What I'm trying to do can be better explained by this link: http://spikeekips.tumblr.com/post/97743913387/embedding-python-in-golang-part-2

Evidently, you can see that I am trying to create multiple python environments via goroutines with which I can access any given python module in a concurrent fashion.

As per the aforementioned link, you can see this doesn't seem to be possible because of goroutines inherently being very different from a real thread in nature, in which case, the library https://github.com/liamzdenek/go-pthreads comes to aid and solves the problem, albeit, not as elegantly as one would like with Go.

What I basically wanted, as a feature request, was a pure go-based method to run multiple python modules concurrently using only goroutines. This would help with the various caveats mentioned on the https://github.com/liamzdenek/go-pthreads package github page.

Another thing, I notice with it is that thread.kill, doesn't always work. Just feels very broken.

Thank you for reading this :)

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.