473,662 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

naive misuse?

The documentation for PyThreadState_S etAsyncExc says "To prevent naive
misuse, you must write your own C extension to call this". Anyone care
to list a few examples of such naive misuse?

Johan

Aug 27 '06 #1
3 1655

jo********@gmai l.com wrote:
The documentation for PyThreadState_S etAsyncExc says "To prevent naive
misuse, you must write your own C extension to call this". Anyone care
to list a few examples of such naive misuse?
No? I'll take that then as proof that it's impossible to misuse the
function.

Thanks,
Johan

Aug 28 '06 #2
[jo********@gmai l.com]
>The documentation for PyThreadState_S etAsyncExc says "To prevent naive
misuse, you must write your own C extension to call this". Anyone care
to list a few examples of such naive misuse?
[and again]
No? I'll take that then as proof that it's impossible to misuse the
function.
That's wise ;-) Stopping a thread asynchronously is in /general/ a
dangerous thing to do, and for obvious reasons. For example, perhaps
the victim thread is running in a library routine at the time the
asynch exception is raised, and getting forcibly ejected from the
normal control flow leaves a library-internal mutex locked forever.
Or perhaps a catch-all "finally:" clause in the library manages to
release the mutex, but leaves the internals in an inconsistent state.
Etc. The same kinds of potential disasters accout for why Java
deprecated its versions of this gimmick:

http://java.sun.com/j2se/1.3/docs/gu...precation.html

That said, you can invoke PyThreadState_S etAsyncExc() from Python
using the `ctypes` module (which will be included in 2.5, and is
available as an extension module for earlier Pythons).
Aug 28 '06 #3

jo********@gmai l.com wrote:
jo********@gmai l.com wrote:
The documentation for PyThreadState_S etAsyncExc says "To prevent naive
misuse, you must write your own C extension to call this". Anyone care
to list a few examples of such naive misuse?

No? I'll take that then as proof that it's impossible to misuse the
function.

Thanks,
Johan
I *was* going to say that if you didn't already know the answer to that
question then your use would almost certainly be naive. But I thought
that'd be more nasty than funny, so I bit my tongue.

~Simon

Aug 29 '06 #4

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

Similar topics

5
1460
by: Waqas | last post by:
HI guys, sorry for being naive, but i have wasted alot of time searching for a undergrad. project but cannot come up with anything. can someone generously suggect me something so that i can move forward. I am, I think, in a lot of mess. :P I will be waiting for a response. :) takecare.
9
1567
by: JohnSouth104 | last post by:
Hi I've an asp.net, c#, sql server website and the volumes are starting to rise quickly. I've been asked to look at improving the memory usage of the application. I've not looked at this before so these are probably naive questions: 1. If I close the sql connection every time do I need to close or dispose of the dataset, command or any other objects? 2. Should I use data adaptor instaed of dataset?
7
1515
by: sillyhat | last post by:
Hello, Can someone please help. I have come across code similar to this which I prepared as an example:- /*-------------8<------------------*/ #define ASIZE 10 int main() {
7
1415
by: Rory Campbell-Lange | last post by:
I have a number of web applications which have a large amount of their logic written in plpgsql. For each particular application I have a separate instance of a database. If I need to update functions I have to connect to each database and then run \i fn_function_update.sql. I imagined schemas might allow me to globally update functions across a database hosting many schemas with the same structure. In this scenario my webapp would...
2
1450
by: Rob Clark | last post by:
Hello all, I have a design problem for which my current C++ solution feels more like a hack. :-( I'd like to change that :-) The real problem can be destilled to something like this: One client wants to send data using one specific top layer protocol. At this top layer, there are a number of different protocols, where each one inherits the main Protocol class. And every protocol subclass in turn contains several different
11
1245
by: John Nagle | last post by:
How naive (in the sense that compiler people use the term) is the current Python system? For example: def foo() : s = "This is a test" return(s) s2 = foo() How many times does the string get copied?
3
4883
by: pragy | last post by:
Hey, can any one help me for writing a program of naive gauss elimintaion technique? It's a technique to solve system of simultaneous linear equations using matrix. thanks
17
1709
by: Christopher Benson-Manica | last post by:
Some recent posts got me thinking about how one might have dealt with simplistic malloc() implementations which might return NULL for a 64K request but might accept two 32K requests or four 16K requests. (I'm assuming, perhaps incorrectly, that quality modern implementations will coalesce free space as necessary and if possible to satisfy requests.) I came up with the following (compilable but untested) first cut at code to try a...
1
2485
by: mjm2114 | last post by:
Hi there, I have a question on a naive implementation of a parallel MT that I've done using the fortran version of MT19937ar.f posted in Prof. Matsumoto's website. (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ MT2002/emt19937ar.html) First, I setup a KISS RNG (Marsaglia, 1999) in the master node and seed it. I then use the first 4 outputs from the master node to
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8547
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.