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

How to stop a running embedded interpreter?

Hi!

I have embedded Python in an C++ App.
The Python-Interpreter is running in its own
Thread (I'm using PThreads).

I use PyRun_SimpleString to run Python-Code that the user entered
in an editorwindow.
I want the user to be able to stop the execution of
Python-Code (e.g. using a Cancel-Button).
Unfortunately I can't find a way to do this.

Of course, I can kill the Interpreter-Thread forcibly with
pthread_cancel() but the App will crash if I call any Python API-
Function afterwards.

I thought about starting 2 Threads in Python: One thread checks for a
stop condition (by calling a C-function that checks the Cancel-Button)
and the user-code runs in a second thread. The Problem with this
approach is that there seems to be no possibility for one Python-thread
to kill another.
I don't want the user to have to check fo a stop condition himself either.

Any help is greatly appreciated.

Regards,
Dirk
Sep 18 '06 #1
0 1741

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

Similar topics

7
by: lawrence | last post by:
Suppose I create dynamic web pages with 3 functions (which call other functions to make everything happen, but these 3 you might think of as being the top layer): registerSessions();...
6
by: Perttu Pulkkinen | last post by:
I just want to ask php-community, are they running too fast with new versions. Why: 1) Its not so nice to load 4.2x and then come back couople of months later to find out that php 5 is out while...
0
by: Tim Stanka | last post by:
Hello, I have created a Python class with a Write() function which grabs stdout from the embedded interpreter and appends onto to the text already in a CEdit multiline control with the help of a...
4
by: PalB | last post by:
How to stop running multiple instances of my App in C#? Thanx
1
by: Thomas Korimort | last post by:
Hi! I have embedded a Python interpreter into a C++ framework. When running some Python code in the interpreter, how can i get a traceback with line number file..., when an exception occurs? ...
1
bhing
by: bhing | last post by:
hiya!!! Im assigned to a website where jsp,mysql, and tomcat is used which runs on fedora 5. NOw i wonder why sometimes the tomcat will stop running, so i have to restart it again to keep the...
3
by: ycollet | last post by:
Hello, I've written a C embedded application. I want to open a python gui application in my C program but when I do : PyRun_String( "import gui.py", file_input, pDictionary, pDictionary ); ...
1
by: pssheba | last post by:
Hi, My sp creates an error report. at a certain stage i want it to stop running if there are errors in thar report. I wrote: DECLARE @myparam INTEGER SELECT @myparam=COUNT(*) FROM...
33
by: Sunny | last post by:
Hi, Sometime, when your script is too big, IE Gives you a warning "Stop Running This Script" A script on this page is causing Internet Explorer to run slowly. Does anyone knows, How to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.