1. Steen Jakobsen
  2. PowerBuilder
  3. Tuesday, 12 January 2021 14:39 PM UTC

Hi,

How can i from the PB main program kill a running SharedObject ?

If  I unregister the object it does not destroy and stop until the processing in it has completed and all references to the instance has been destroyed.

Can I use TerminateThread  (win32 api) or is it to much of a risk ?

 

any feedback is most appreciated :-)

 

//Steen

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 12 January 2021 15:20 PM UTC
  2. PowerBuilder
  3. # 1

Hi Steen;

  I normally create an "of_stop" method and call that from the main thread to have the sub-thread immediately stop its processing. Then I proceed with the UnRegister + Destroy.

Regards ... Chris

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 12 January 2021 16:00 PM UTC
What I do in the "of_stop" is set a Boolean ib_stop variable and then in my processing loops ...

For example:

FOR li_loop to li_max

IF ib_stop = TRUE THEN

ib_rc = -2 // Processing stopped

EXIT

else

// Processing here

END IF

NEXT

RETURN ib_rc

Regards ... Chris
  1. Helpful
  1. Steen Jakobsen
  2. Wednesday, 13 January 2021 06:07 AM UTC
Thanks Chris,



That is also what I do .. you need an Yield() in the loop to receive the signal to your ib_stop.

also you might consider THROW of a decendant exception instead og having to code a deep deep callstack return structure.



I just thought it would be so much easier if I could kill the thread instead of coding for the cancelation.



Do you know if ShareObjects are long term supported by Appeon and do you know it is is stable to use in serious applications ?



Thanks :-)

//Steen



ps. R3 Beta 2 ROCKS :-)

  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 13 January 2021 16:42 PM UTC
Hi Steen;

Good idea about using a Yield() in any thread's looping.

AFAIK, there are no plans to deprecate the SharedObject feature in Appeon PB. I have used this feature in many PB Apps and I also know of many PB shops that have Apps that use it. I also support this feature in my STD Framework. I have had a lot of people tell that they use it as well.

Yes, R3 Beta 2 is much further along feature / stability wise. :-)

Regards ... Chris

.
  1. Helpful
There are no comments made yet.
Steen Jakobsen Accepted Answer Pending Moderation
  1. Thursday, 14 January 2021 05:20 AM UTC
  2. PowerBuilder
  3. # 2

Thanks Chris for your valuable feedback and knowledge :-)

 

//Steen

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 14 January 2021 17:03 PM UTC
Welcome ... HTH! :-)
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.