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

naive misuse?

The documentation for PyThreadState_SetAsyncExc 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 1646

jo********@gmail.com wrote:
The documentation for PyThreadState_SetAsyncExc 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********@gmail.com]
>The documentation for PyThreadState_SetAsyncExc 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_SetAsyncExc() 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********@gmail.com wrote:
jo********@gmail.com wrote:
The documentation for PyThreadState_SetAsyncExc 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
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...
9
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...
7
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
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...
2
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...
11
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...
3
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
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...
1
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....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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,...

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.