Article View: comp.os.os2.programmer
Article #2461Help With Unblocking Threads
From: Andreas Kaiser
Date: Sun, 17 Mar 1991 09:09
Date: Sun, 17 Mar 1991 09:09
24 lines
1934 bytes
1934 bytes
In einer Message an All, vom <16 Mar 142 03:02>, schreibst Du:
CG> I have a multi-thread application. There are 4 threads, although
CG> only 2 are of interest here. The main thread controls network
CG> operations, and thread 2 controls the keyboard. If the user wants
CG> to terminate the connection, they hit Esc. When the keyboard thread
CG> detects the Esc key stroke, it calls DosFlagProcess and ends. This
CG> in turn unblocks the network read (EINTR) and thread 1 cleans up
CG> and does some other processing. This all works great.
CG> A problem arises however when the server application wants to end
CG> the transaction. The network read ends when the connection is closed,
CG> but how do I end the keyboard thread???
By DosExit :-). The "famous" multi-threading of OS/2 is seriously incomplete, since the only way to control threads is Suspend. That's it. No signalling, no way to kill a thread.
If you need threads which have to communicate by signals or have to kill each other, use parallel processes with shared memory.
There is another way: The MSDOS approach ;-). Forget all you learnt about efficient multitasking and do a timer-poll on every resource which does not have a timeout possibility. Not the way OS/2 was built for, but sometimes is the only way to do real-time processing, especially since device monitor calls do not have timeouts.
Gruss, Andreas
* Origin: kaiser@ananke.stgt.sub.org - Stuttgart (2:244/7014.0)
Technical Details
Message-ID:
<669205541.1@ananke.Fidonet.stgt.sub.org>Path:
arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!snorkelwacker.mit.edu!ira.uka.de!smurf!nadia!ananke!FredMailShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!snorkelwacker.mit.edu!ira.uka.de!smurf!nadia!ananke!FredMail From: Andreas.Kaiser@p0.f7014.n244.z2.Fidonet.stgt.sub.org (Andreas Kaiser) Newsgroups: comp.os.os2.programmer Subject: Help With Unblocking Threads Message-ID: <669205541.1@ananke.Fidonet.stgt.sub.org> Date: 17 Mar 91 09:09:00 GMT Sender: FredMail@p822.f7014.n244.z2.Fidonet.stgt.sub.org Lines: 24