[comp.os.os2.programmer] Killing threads

delft@fwi.uva.nl (Andre van Delft) (06/09/91)

It is possible to launch a thread under OS/2, and to suspend and resume it.
Can you also kill a thread explicitely, like with processes?

Andre van Delft
delft@fwi.uva.nl

feustel@netcom.COM (David Feustel) (06/09/91)

Absolutely not! No! No! No! Killing threads is against OS/2 rules!
Shame on you for even thinking about it, much less suggesting it.
Your punishment is to write 100 times " I will never ever again even
think about suggesting that I would like to be able to kill an OS/2
thread".
(Signed) Big Brother Microsoft and Big Blue.
-- 
David Feustel, 1930 Curdes Ave, Fort Wayne, IN 46805, (219) 482-9631
EMAIL: feustel@netcom.com  or feustel@cvax.ipfw.indiana.edu

wohler@sapwdf.UUCP (Bill Wohler) (06/11/91)

  to suspend and resume threads, see, oddly enough, DosSuspendThread and
  DosResumeThread.

feustel@netcom.COM (David Feustel) writes:
>Absolutely not! No! No! No! Killing threads is against OS/2 rules!

  not having a way to do it and being against the rules are two
  different things.  we hack it by having all of our threads check a
  global variable often.  when this variable is set, they exit.

  osf1 (not os/2) woke up and will provide an api call to kill threads.
-- 
						--bw
-----
Bill Wohler <wohler@sap-ag.de> <sapwdf!wohler>
Heidelberg Red Barons Ultimate Frisbee Team

seg@ingres.com (scott e garfinkle) (06/12/91)

In article <1991Jun8.234338.8440@fwi.uva.nl> delft@fwi.uva.nl (Andre van Delft) writes:
>It is possible to launch a thread under OS/2, and to suspend and resume it.
>Can you also kill a thread explicitely, like with processes?

Not currently, much to most everyone's chagrin.  It seems very likely, though,
that, at some point before gerneral availability of 2.0, the IBM kernel
group will make it possible for one thread to raise an exception in another
thread.  Then you will be able to kill off threads in a fairly orderly way.
	-scott e. garfinkle

feustel@netcom.COM (David Feustel) (06/12/91)

wohler@sapwdf.UUCP (Bill Wohler) writes:


>  to suspend and resume threads, see, oddly enough, DosSuspendThread and
>  DosResumeThread.

>feustel@netcom.COM (David Feustel) writes:
>>Absolutely not! No! No! No! Killing threads is against OS/2 rules!

>  not having a way to do it and being against the rules are two
>  different things.  we hack it by having all of our threads check a
>  global variable often.  when this variable is set, they exit.


	Actually, you CAN kill ALL threads within an OS/2 process by simply
	killing the process. What you cannot do is kill a specific
	thread without killing the process.

>  osf1 (not os/2) woke up and will provide an api call to kill threads.
>-- 
>						--bw
>-----
>Bill Wohler <wohler@sap-ag.de> <sapwdf!wohler>
>Heidelberg Red Barons Ultimate Frisbee Team
-- 
David Feustel, 1930 Curdes Ave, Fort Wayne, IN 46805, (219) 482-9631
EMAIL: feustel@netcom.com  or feustel@cvax.ipfw.indiana.edu

feustel@netcom.COM (David Feustel) (06/12/91)

>>Can you also kill a thread explicitely, like with processes?

>Not currently, much to most everyone's chagrin.  It seems very likely, though,
>that, at some point before gerneral availability of 2.0, the IBM kernel
>group will make it possible for one thread to raise an exception in another
>thread.  Then you will be able to kill off threads in a fairly orderly way.
>	-scott e. garfinkle

How will the threads be killed? Will there be a new system call, or
what?
-- 
David Feustel, 1930 Curdes Ave, Fort Wayne, IN 46805, (219) 482-9631
EMAIL: feustel@netcom.com  or feustel@cvax.ipfw.indiana.edu

seg@ingres.com (scott e garfinkle) (06/12/91)

>>...  It seems very likely, though,
>>that, at some point before gerneral availability of 2.0, the IBM kernel
>>group will make it possible for one thread to raise an exception in another
>>thread.  Then you will be able to kill off threads in a fairly orderly way.
>
>How will the threads be killed? Will there be a new system call, or
>what?

As I said, one way or another, you will be able to rais an excpetion in
another thread.  My assumption would be something like DosRaiseException
with a second argument.  By specifying the EH_NONCONTINUABLE flag and an
appropriate exception number, you could make sure that the target thread dies.
This way, you also give the target thread a chance to protect itself by
registering an excpetion handler.  Of course, the whole excpetion mechanism
is not real intuitive, but it's better than nothing.

It bears pointing out that I am in no way affiliated with IBM, and that
any statements made here are sheer speculation.
	-scott e. garfinkle