Git Product home page Git Product logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 3, 2024
I am not aware of a way of killing all threads in Python.  If you know such a 
way
please let me know and I will try to incorporate it.  (So I won't implement this
until I can find a good way of doing it).

What you can do instead is reinitialize the remote interpreter. 

Original comment by pyscripter on 23 Mar 2007 at 2:00

  • Changed state: Wont-do

from pyscripter.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 3, 2024
use ToolHelp32 API

---

interface

uses
  Windows, tlhelp32;

type
  TIntArray = array of DWord;

Function GetThreads(ProcessID : DWord): TIntArray;

implementation

Function GetThreads(ProcessID : DWord): TIntArray;
var
  ThreadEntry32 : TThreadEntry32; {Defined in TlHelp32}
  TLHandle : THandle;
begin
  SetLength(Result, 0);
  TLHandle := CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
  if Thread32First(TLHandle,ThreadEntry32) then
  begin
    if ThreadEntry32.th32OwnerProcessID = ProcessID then
    Begin
      SetLength(Result, Length(Result)+1);
      Result[Length(Result)] = ThreadEntry32.th32ThreadID;
    end;
    while Thread32Next(TLHandle,ThreadEntry32) do
    begin
      if ThreadEntry32.th32OwnerProcessID = ProcessID then
      begin
        SetLength(Result, Length(Result)+1);
        Result[Length(Result)] = ThreadEntry32.th32ThreadID;
      end;
    end;
  end;
  CloseHandle(TLHandle);
end;

Original comment by [email protected] on 9 Apr 2007 at 11:08

from pyscripter.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 3, 2024
Thanks for the code snippet.

Was this issue about killing thread created by your Python code or killing 
Pyscripter
threads (which should be killed anyway)?

If you are referring to your Python threads aren't those killed when you 
reinitialize
the interpreter?

Please provide a bit more info.

Original comment by pyscripter on 12 Apr 2007 at 10:22

from pyscripter.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 3, 2024
When the bad-manner-script is repeatedly executed,
I must end by force the PyScripter.

My solution is to do reinitialize,
every time before the script running on remote engine.

When PyScripter is the state as it is
I cannot recommend PyScripter to be used for the beginner. 

solution1:
  PyScripter manages threads that target-script started.
  If those threads remain when debugging ends,
  they are killed by PyScripter.

solution2:
  When you use a remote engine,
  PyScripter add a option setting:
    "Reinitialize does a remote engine before execute" 

Original comment by [email protected] on 17 Apr 2007 at 8:49

from pyscripter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.