TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Schuller
from: Darin McBride
date: 1997-02-07 16:01:04
subject: Re: Multiple threads accessing the same files

> To access multiple files, use sharing.  One option 
 > is sopen - not ANSI, 
 > IIRC, but available in many compilers (Watcom 
 > included).  The other option 
 > is to use DosOpen directly (I would recommend writing some sort of io 
 > library to go with it just in case you want to port 
 > to AIX or something - 
 > then you just rewrite the library rather than everything else).

 PS> There's only one thin with this sharing stuff. In read-
 PS> only mode it's okay, 
 PS> but not if data are to be written. And as you mentioned DosOpen (I think 
 PS> too...) can w8 for a file to become avaliable if it's 
 PS> not. But the problem 
 PS> then would be that if an other thread/proccess accesses 
 PS> the file and locks up, 
 PS> the file will be locked for ever - causing the BBS to 
 PS> hang. But in the other 
 PS> hand I'd be better do do my own loop instead of letting DosOpen handle it.

If it locks up, yes.  If it crashes, no.

 PS> But this C/S thing. So what you mean is that I should 
 PS> 'create' a file that the 
 PS> client reads directly through the server via a pipe? 
 PS> Let's see, pipe can be 
 PS> read via DosOpen, right? I don't remember, but if so that's the perfect 
 PS> solution! If a node wants to write data, then the 

Yup - you read it via read/write calls.  (Not "DosOpen" -
DosRead/DosWrite!)

 PS> server could create a temp-
 PS> file, and when the client closes the file, the server 
 PS> could write the data to 
 PS> it. That's perfect! Only it takes up resources, but I'll have to doo. It 

Actually, the server would ideally copy the info into memory, and handle
conflicts in memory.  It would only touch the disk during the write.

 PS> won't be easy to hang the BBS as long as I make the 
 PS> server stable as hell. I 

That's the idea, yeah... stable servers.  :-)

 PS> think I'll go with that unless you have another opinion maybe?

C/S design is not easy.  Especially GOOD, STABLE C/S design.  I believe I
mentioned DB2 - if you can shell the cash, it's probably your best bet.  It
already _is_ C/S and has all the protection available.  Mind you,
distribution costs may be prohibitive.  I also believe I saw some sort of
multi-thread database come through FW_PROG or whatever a few days ago - as
shareware, its redistribution cost may be much lower.  As with DB2, it was
also cross-platform although not to the same degree as DB2.

Good luck,


--- Maximus/2 3.01
* Origin: Tanktalus' Tower BBS (PVT) (1:342/708)
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: 342/5015 61 3615/50 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™.