Article View: comp.os.os2.programmer.misc
Article #10Re: Q: How do DLLs and threads work in OS/2? (VX-REXX)
From: Carsten Whimster
Date: Fri, 20 Oct 1995 12:09
Date: Fri, 20 Oct 1995 12:09
36 lines
2388 bytes
2388 bytes
In article <DGqB16.Gn4@undergrad.math.uwaterloo.ca>,
Eric Giguere <giguere@csg.uwaterloo.ca> wrote:
| You're confusing threads vs. processes. You start a new process each
| time you run an executable. Each process has 1 or more threads running
| in it, and it's the threads within the same process that you have
| to worry about, since each thread has access to all the memory space
| used and allocated by any other thread inside the same process.
|
| Depending on your linker options (or .DEF file for non-Watcom users)
| you can set up your DLL so that its data is shared between threads
| in different processes or only between threads in the same process.
| Usually you want the latter, and that's the case you have.
|
| Here's what you should do to explore this further: read up about
| the StartThread method in VX-REXX and then add a second thread to
| your program. Make both threads call into your DLL and see what
| happens.
|
| After that experiment you'll want to learn about critical sections
| and semaphores.
Ah, ok. I do know about semaphores and critical sections, and if I
ever add multi-threading to this particular program, I'll problably
add semaphores to the data accesses, but at the moment, my program is
just a front-end for a commandline compiler, and really doesn't need
multiple threads. For this reason, when you mentioned threads, I
automatically thought you meant process threads, not giving a single
thought to multi-threaded apps. Thanks for the clarification.
I may add semaphores to my DLL in any case, just so that if I ever do
use threads, it'll be ready.
--
Carsten Whimster bcrwhims@uwaterloo.ca
EDM/2 Associate Editor and Book reviewer
Team OS/2 POV-Panel/2 author
http://www.undergrad.math.uwaterloo.ca/~bcrwhims/
Technical Details
Message-ID:
<DGqxsJ.u7@undergrad.math.uwaterloo.ca>Path:
arc1-ca.pugleaf.net!undergrad.math.uwaterloo.ca!bcrwhimsReferences:
<DGqB16.Gn4@undergrad.math.uwaterloo.ca>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer.misc,comp.lang.rexx Path: arc1-ca.pugleaf.net!undergrad.math.uwaterloo.ca!bcrwhims From: bcrwhims@undergrad.math.uwaterloo.ca (Carsten Whimster) Subject: Re: Q: How do DLLs and threads work in OS/2? (VX-REXX) Message-ID: <DGqxsJ.u7@undergrad.math.uwaterloo.ca> Sender: news@undergrad.math.uwaterloo.ca (news spool owner) Date: Fri, 20 Oct 1995 12:09:55 GMT References: <DGqB16.Gn4@undergrad.math.uwaterloo.ca> Nntp-Posting-Host: cayley.uwaterloo.ca Organization: University of Waterloo