On Mon, Feb 25, 2019 at 6:03 PM Randall O'Reilly <rcoreil...@gmail.com>
wrote:

> Kurtis — thanks for the suggestion — I had assumed that python always just
> runs in the main thread, and when I added this code to my python script, it
> shows that it is indeed running in the main thread


I probably assumed too much when reading your original problem statement.
Python code always run in the main thread, as far as I know, unless you
have used the `threading` module, either directly or indirectly, to spawn
additional threads. The wording of your original problem statement implied
you were calling a Go function from python. In which case that Go function
should execute on the main thread if you haven't explicitly created
additional threads from the main python thread. But you can't assume that
loading your Go module from the python main thread will ensure the Go
functions execute on the main thread.

I've worked a lot with C++ code that utilizes threads and which is loaded
by a python program. But that doesn't involve anything like the Go M:N go
routine to thread scheduler. There are probably subtleties in mixing the
two languages that I'm not familiar with.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to