extension module initialization called twice

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pianomaestro@gmail.com

    extension module initialization called twice


    I have a cython extension module "mux" where the initialization is
    being
    called more than once (the initmux c function).
    I am wondering if my use of multiple threads causes this. Can't
    multiple
    threads share the same python module ?

    The threads are being created from an external C library.
    I just call PyEval_InitThre ads on startup, and then acquire the
    gil from the c callbacks.

    Here is my gdb session:

    (gdb) break initmux
    Breakpoint 1 (initmux) pending.
    (gdb) break PyEval_InitThre ads
    Breakpoint 2 at 0x80c2906
    (gdb) run prod-foo.py
    Starting program: /usr/bin/python prod-foo.py
    (no debugging symbols found)
    (no debugging symbols found)
    (no debugging symbols found)
    [Thread debugging using libthread_db enabled]
    [New Thread -1210001216 (LWP 11155)]
    (no debugging symbols found)
    (no debugging symbols found)
    (no debugging symbols found)
    (no debugging symbols found)
    (no debugging symbols found)
    [Switching to Thread -1210001216 (LWP 11155)]

    Breakpoint 2, 0x080c2906 in PyEval_InitThre ads ()
    (gdb) c
    Continuing.
    Breakpoint 3 at 0xb787c919: file mux.c, line 6829.
    Pending breakpoint "initmux" resolved

    Breakpoint 3, initmux () at mux.c:6829
    6829 __pyx_m = Py_InitModule4( "mux", __pyx_methods, 0, 0,
    PYTHON_API_VERS ION);
    (gdb) c
    Continuing.
    [New Thread -1419904112 (LWP 11158)]
    [New Thread -1420432496 (LWP 11159)]
    [New Thread -1420960880 (LWP 11160)]
    [New Thread -1421489264 (LWP 11161)]
    [New Thread -1422017648 (LWP 11162)]
    [New Thread -1422546032 (LWP 11163)]
    [New Thread -1424647280 (LWP 11164)]

    Breakpoint 3, initmux () at mux.c:6829
    6829 __pyx_m = Py_InitModule4( "mux", __pyx_methods, 0, 0,
    PYTHON_API_VERS ION);
    (gdb)


    Simon.

Working...