TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: David Noon
from: Murray Lesser
date: 1996-02-03 07:41:00
subject: Pl/i Multithreading

Excerpted from message dated 01-30-96, David Noon to Murray Lesser:

DN>The DETACH statement cleans up the run-time resources owned by
  >another thread. However, it cannot do that if the thread is still a
  >candidate for dispatch. Therefore, you need to kill the thread (STOP
  >THREAD statement) or wait for it to complete (WAIT THREAD statement)
  >before you can use DETACH on it. Otherwise, you'd be taking the stack
  >and much else away from a thread that might be currently executing on
  >another CPU inside a SMP box. [E.g. a 10-way ES/9000 mainframe, if
  >you've got the millions to buy one.]

Hi David--

    Thank you.  According to the Language Reference, "EXIT" executed by
the "main thread" will terminate all other other threads
("When the main
thread terminates, all resources are released and files are closed.") In
my multithreaded program, I am now STOPping the thread and then ending
the "main thread" with an EXIT.  Two supplementary questions: Should I
still DETACH the thread (as well as STOPping it) before the EXIT?  Is it
very poor programming practice to not even STOP the thread before the
main program EXIT command?

    Both threads are currently running on a single-processor system.  I
can't even afford the air conditioning and raised floor necessary to run
your ES/9000 mainframe!

    I have stolen your tag line.  Thanks.

          --Murray

---
* Origin: 2" x 4" bbs - a basic board - (914) 271-9407 (1:2625/108)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 2625/108 1 2619/211 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.