473,414 Members | 1,626 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,414 software developers and data experts.

Releasing GIL in unknown state

Hi,

Is there a proper way for C code to ensure that the GIL is released? I
know about PyGILState_Ensure and PyGILState_Release, but that is to
ensure the GIL is acquired. I have some extension code that does heavy
processing and I want to release the GIL, but the code can't be sure
that the GIL is already acquired. All I can think of so far is the
following:

PyGILState_STATE state = PyGILState_Ensure();

Py_BEGIN_ALLOW_THREADS

//do processing

Py_END_ALLOW_THREADS

PyGILState_Release(state)
Is there a better way?

-Farshid
Aug 30 '06 #1
0 1069

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

Similar topics

4
by: lebo | last post by:
Hi I'm trying to understand how Python handles memory usage and dynamic object loading and unloading. Problem to solve? Build a very low memory footprint (non-GUI) Python application for...
31
by: poisondart | last post by:
Hi, I'm not sure if this is the right group to post this. If not, then I would appreciate if somebody could point me to the correct group. This is my first time releasing software to the...
1
by: AMercer | last post by:
In a VB .NET app, I am dynamically changing a form's menu. While stress testing the code in the IDE, I got intermittent exceptions thrown: "An unhandled exception of type...
18
by: lylefair | last post by:
Can you post code, or a reference to a md? or ad? file on a website, where object variables are not released when they go out of scope and cause a problem, (but causing a problem is extraneous to...
2
by: Jose Betances | last post by:
I set up SQL Server in Computer A, and running a c# application from computer B. When I attempt to create an SqlConnection object an error is raised. The message is "Unknown connection option in...
6
by: quilkin | last post by:
I am getting a System.Data.SqlClient.SqlException with a message string of 'Unknown Error'. Happens occasionally when creating a "new SqlCommand(...)" while the same command works perfectly happily...
2
by: Nospam | last post by:
I installed a script that is suppose to accept paypal, however on trying to test a payment, I get this error msg: Error Database access error and I get this error msg emailed to me:
3
by: Eric | last post by:
Hi, I wonder if it is possible to import and use an unknown dll in a C# program? I.e. get to know what public variables, methods, properties etc. the dll contains and get to know what parameters to...
0
by: Shaun | last post by:
Hi all, I'm trying to implement a custom session handler that writes session data to a MySQL database. It works fine about 99% of the time. Trouble is, at random intervals, I get entries like...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.