Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGoRoutines #42
GoRoutines #42
Comments
|
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. |
|
(apologies for the belated answer) No, That said, could you explain a bit what you were trying to do? |
|
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 :) |
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.