Pause a thread/ execfile()

Babloo pruthviraj.pb at gmail.com
Mon Oct 26 04:19:29 EDT 2009


On Oct 26, 1:11 pm, Saju Pillai <saju.pil... at gmail.com> wrote:
> On 26/10/09 12:28 PM, Babloo wrote:
>
> > i have a small python application with GUI (frontend) which has
> > various functions. I have a "RUN" button which runs python scripts in
> > the background . It basically calls execfile() function internally
> > which runs in a thread ,  to run the python script .
>
> > I want to implement a "PAUSE" feature which would pause the running
> > python script . So do that i have to either pause the thread in which
> > execfile() runs or pause execfile itself .
>
> > When the user presses "RUN" again then the python script should resume
> > running .
>
> > Any ideas how to pause the thread / pause execfile() . Any other ideas
> > for the same would be helpful .
>
> Other ideas ? You could use job control signals if you are on unix. Try
> forking a child process instead of using a thread. Sending SIGSTOP to
> the forked child will stop/pause it, SIGCONT will resume it.
>
> -srp

Hi ,
Thanks for the reply .  I am on windows platform ... yeah if was on
linux things would have been easier !!



More information about the Python-list mailing list