473,378 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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_InitThreads 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_InitThreads
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_InitThreads ()
(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_VERSION);
(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_VERSION);
(gdb)
Simon.

Mar 27 '08 #1
0 1130

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lee Stewart | last post by:
Another question about writing PHP 5 extensions. What's the difference in PHP_MINIT() / PHP_MSHUTDOWN() and PHP_RINIT() / PHP_RSHUTDOWN()? When would a "per request" init be made? Thanks,...
3
by: Anand | last post by:
I have a unexpected issue with python modules (well i kind of know why, but i am trying to find if there is a way around) Intro: I am allowing an external application to actually run python...
8
by: Torsten Mohr | last post by:
Hi, i write an extension module in C at the moment. This module does some work on some own data types that consist of some values. The functions that can change the data are written in C. ...
4
by: Al Norman | last post by:
We have two separate DLLs that do not interact (directly, at least). One is an MFC extension DLL that was built back in VC++ 6 days (but has been recompiled with VS2005). The other is a DLL that...
1
by: Yue.Nicholas | last post by:
Hi, I have written a small prototype Python extension for a C-library. I have the methods all sorted out and it is working fine. In the C-library, they are various constants of types like...
5
by: malkarouri | last post by:
Hi everyone, Is it possible to write a Python extension that uses the Boehm garbage collector? I have a C library written that makes use of boehm-gc for memory management. To use that, I have...
5
by: Chuck Anderson | last post by:
I run Apache 2.0.55, and Php (both 4.4.1 and 5.2.5) on my home PC (Windows XP). One of the scripts that I run daily needs to access a secure URL (https://..............). When I am running Php4,...
6
by: pianomaestro | last post by:
I have an extension module that gets initialized multiple times because I am using threads. How can this module access global state (not per-thread state) ? It needs to create a singleton. ...
6
by: dudeja.rajat | last post by:
Hi, I found on the net that there is something called module initialization. Unfortunately, there is not much information for this. However, small the information I found module initialization...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.