TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Schuller
from: Peter Fitzsimmons
date: 1997-02-04 02:43:28
subject: Multiple threads accessing the same files

PS> Hi!

 PS> I'm currently developing a BBS system, and of course - 
 PS> multinode. This means 
 PS> that there will be multiple threads or processes (depending on how I'll 
 PS> implement it) be accessing the same files! Let's take the message-files 
 PS> and file-files for instance. If 4 nodes wishes to read/write to the same 
 PS> message/file-base (thus, the same file), how do I 
 PS> coordinate this?

Many possibilities.  Two obvious ones: file locking, and client/serevr
(C/S). File locking is like a mutex semaphore implemented by the file
system (slow, but useful if you want multiple copies of your program
running on more than on networked PC (although C/S would be even better in
that situation).

Best: client/server.  Even if it is all within one process,  a
client/server thread relationship will stil work.

I suggest, as the first step,  you design the API (or c++ class) and then
think about how to implement it later (once you've designer a good api, the
implementation may very well deliver itself on a silver platter) .

Maximus/squish use file locking (we had to support dos;  I wanted C/S...). 
You could use msgapi.dll if you wanted (Paul Edwards has cloned a p/d
version with source code...)



--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 50/99 54/99 270/101 620/243 625/160 711/401 413 430 934 712/311 407
SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1
@PATH: 259/414 99 2424/38 11 10 12/12 396/1 270/101 712/624 711/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™.