Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Stopping a Thread (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: RB 4.5 Database Plugins : 4D Server 6.8 ?
Next thread: Beginner: About Printing


Re: windows opening - closing noices ?   -   Frank Bitterlich
  Stopping a Thread   -   Stéphane Pinel <
   Re: Stopping a Thread   -   Frank Bitterlich
    Re: Stopping a Thread   -   Stéphane Pinel <
     Re: Stopping a Thread   -   Joseph J. Strout
      Re: Stopping a Thread   -   Stéphane Pinel <
       Re: Stopping a Thread   -   Joseph J. Strout
        Re: Stopping a Thread   -   Chris Cummer
         Re: Stopping a Thread   -   Stéphane Pinel <
          Canvas MouseDown/MouseUp   -   Stéphane Pinel <
   Re: Stopping a Thread   -   Joerg Pressel
   Re: Stopping a Thread   -   Will Leshner
   Re: Stopping a Thread   -   Sascha René Leib <
   Re: Stopping a Thread   -   Leo Makkinje

Stopping a Thread
Date: 01.08.02 13:58 (Thu, 01 Aug 2002 14:58:01 +0200)
From: Stéphane Pinel <
No matter how I try to stop a Thread, the IDE or compiled app scratch. Is
there a clean way to stop a Thread ?

Thanks.

Re: Stopping a Thread
Date: 01.08.02 14:02 (Thu, 01 Aug 2002 15:02:09 +0200)
From: Frank Bitterlich
How do you _stop_ a thread? AFAIK the only way to stop it, is to exit
from it's .Run method. What happens if you do that?

Cheers,
Frank+++

Stéphane Pinel wrote:
>
> No matter how I try to stop a Thread, the IDE or compiled app scratch. Is
> there a clean way to stop a Thread ?

-

Re: Stopping a Thread
Date: 01.08.02 15:06 (Thu, 01 Aug 2002 16:06:08 +0200)
From: Stéphane Pinel <
Le 1/08/02 15:02, « Frank Bitterlich » <<email address removed>> a écrit :

> How do you _stop_ a thread? AFAIK the only way to stop it, is to exit
> from it's .Run method. What happens if you do that?
>
...crash....

--
St

Re: Stopping a Thread
Date: 01.08.02 15:18 (Thu, 1 Aug 2002 07:18:39 -0700)
From: Joseph J. Strout
At 4:06 PM +0200 8/1/02, Stéphane Pinel wrote:

> > How do you _stop_ a thread? AFAIK the only way to stop it, is to exit
> > from its .Run method. What happens if you do that?
> >
>...crash....

That is the correct (and only) way to stop a thread. The crash is
caused by something else (and do you really mean a crash, or do you
mean some unhandled exception in your code?).

Cheers,
- Joe

-

Re: Stopping a Thread
Date: 01.08.02 15:36 (Thu, 01 Aug 2002 16:36:52 +0200)
From: Stéphane Pinel <
Le 1/08/02 16:18, « Joseph J. Strout » <<email address removed>> a écrit :

> At 4:06 PM +0200 8/1/02, Stéphane Pinel wrote:
>
>>> How do you _stop_ a thread? AFAIK the only way to stop it, is to exit
>>> from its .Run method. What happens if you do that?
>>>
>> ...crash....
>
> That is the correct (and only) way to stop a thread. The crash is
> caused by something else (and do you really mean a crash, or do you
> mean some unhandled exception in your code?).

The message is explain that the application has unexpectedly quit etc...(in
French, so I suppose its a system message). Maybe the fact that the Thread
exits during some DB operations (even If everything is closed -RecordSet,
Database- before exiting) is the cause of the crash ?

Thanks.

--
Sté

Re: Stopping a Thread
Date: 01.08.02 15:48 (Thu, 1 Aug 2002 07:48:39 -0700)
From: Joseph J. Strout
At 4:36 PM +0200 8/1/02, Stéphane Pinel wrote:

>The message is explain that the application has unexpectedly quit etc...(in
>French, so I suppose its a system message). Maybe the fact that the Thread
>exits during some DB operations (even If everything is closed -RecordSet,
>Database- before exiting) is the cause of the crash ?

Could be. Try to pare down your app to as simple as you can; in the
process, you will probably discover what is causing it. That may
allow you to work around it for your own purposes, and also send us a
nice bug report we can work with to fix the problem.

Best,
- Joe

-

Re: Stopping a Thread
Date: 01.08.02 21:15 (Thu, 01 Aug 2002 16:15:45 -0400)
From: Chris Cummer
Joseph J. Strout wrote:

> Maybe the fact that the Thread
>> exits during some DB operations (even If everything is closed -RecordSet,
>> Database- before exiting) is the cause of the crash ?

Do you have multiple threads accessing the db? Closing it in one will crash
any others.

Cheers,
Chris

________________________________________________________________
PostalCode, Inc. (416) 737-2633
http://www.postal-code.com
________________________________________________________________

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Stopping a Thread
Date: 01.08.02 21:34 (Thu, 01 Aug 2002 22:34:05 +0200)
From: Stéphane Pinel <
Le 1/08/02 22:15, « Chris Cummer » <<email address removed>> a écrit :

> Joseph J. Strout wrote:
>
>> Maybe the fact that the Thread
>>> exits during some DB operations (even If everything is closed -RecordSet,
>>> Database- before exiting) is the cause of the crash ?
>
> Do you have multiple threads accessing the db? Closing it in one will crash
> any others.
>
No. Only one thread deals with the DB.

A+
--
St

Re: Stopping a Thread
Date: 01.08.02 15:23 (Thu, 01 Aug 2002 16:23:55 +0200)
From: Joerg Pressel
on 01.08.2002 14:58 Uhr, Stéphane Pinel at <email address removed> wrote:

> No matter how I try to stop a Thread, the IDE or compiled app scratch. Is
> there a clean way to stop a Thread ?

I do it the following way:

Put the properties "isRunning As Boolean" and "doStop As Boolean" into the
Thread.

In the Threads Run event:

isRunning = True

// do your stuff here
// somewhere in here test for doStop - e.g. in a for loop do:

For i = 0 to 1000
If (doStop) Then
Exit
End if
Next

isRunning = False


Stopping your thread can be done with a method in your Thread:

Function Stop()
doStop = True
While (isRunning)
Wend
End

After calling Stop it's safe to Nil your thread, because it's no longer
running.

HTH,

Jörg

____________________________________________
three-2-one interaktive Medien GmbH

<email address removed>
http://www.three-2-one.com
fon: +49 2151 319450

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Stopping a Thread
Date: 01.08.02 19:00 (Thu, 1 Aug 2002 11:00:51 -0700)
From: Will Leshner
What have you tried? If you return from Run then the thread should stop.
The trick is returning from Run.

On Thursday, August 1, 2002, at 05:58 AM, Stéphane Pinel wrote:

> No matter how I try to stop a Thread, the IDE or compiled app scratch.
> Is
> there a clean way to stop a Thread ?

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Stopping a Thread
Date: 01.08.02 16:45 (Thu, 1 Aug 2002 17:45:37 +0200)
From: Sascha René Leib <
Stéphane Pinel wrote:

> No matter how I try to stop a Thread, the IDE or compiled app scratch. Is
> there a clean way to stop a Thread ?

My thread classes usually get a property like "stopping as Boolean" and a
method "Stop".

When I call "mythread.Stop()", it just sets the "stopping" property to true.

The "Run()"-Event (and all called methods) check from time to time whether
the "stopping" is true, and stop their activities accordingly.

This way, I can make sure the Thread is ending in a good manner.. Cleaning
up behind it, etc.

Greetings

/sascha

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Stopping a Thread
Date: 01.08.02 17:39 (Thu, 01 Aug 2002 18:39:01 +0200)
From: Leo Makkinje
Stéphane Pinel wrote:

> No matter how I try to stop a Thread, the IDE or compiled app scratch. Is
> there a clean way to stop a Thread ?

Did you open a window or dialog from within the thread? Do you close it
before ending the thread?

Leo.

________________________________________________________________________
Leo Makkinje <email address removed>
Vechtwijk Automatisering www.vechtwijk.nl
Weesp, the Netherlands www.popmonitor.com

Got spam? Get POPmonitor!
http://www.popmonitor.com



---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>