[comp.lang.pascal] Share

lion@dat1hb.north.de (Daniel Tietze) (06/24/91)

    Hi!
  I'm sorry if the answer to this question seems ovious to you, you may
be just the one person who knows all his interrupts by heart. I don't,
so could someone please help? (reading some of the replies posted in
this newsgourp, I thought this preface was adequate).
  I have a question about using SHARE (as supplied with MS-DOS) with
Turbo Pascal programs. How can I check SHARE violations in my program?
What exactly does SHARE do when it encounters a sharing violation? I
believe the IOResult is set to an appropriate value, but I don't
know exactly which result is to be expected.
  How can I get the program to retry after a sharing violation. Do I
have to code it explicitly (i.e. repeat .... until (share_ok OR
computer_switched_off; :-) ) or does SHARE take care of that?
  By the way, when exactly does a sharing violation occur? In Read/Read,
Read/Write or Write/Write situations?
  The problem to be solved is: I want to make my BBS multi-nodeable and
two users accessing the same Board at the same time could prove fatal in
certain situations, so I have to have a way of getting around this,
don't I?
    Any help would, as usual, be greatly appreciated.
        Daniel


+------------------------------------------------------------------+
| Daniel Tietze, 2800 Bremen 1,  Tel.(voice) : 0421/448806         |
|-=============- DATELINE Communications, Bremen.  The home of DMS |
| Mail: (private) lion@dat1hb.north.de (univ) E07J@DHBRRZ41.BITNET |
|-====- DMS-Support: dateline@dat1hb.north.de                      |
+------------------------------------------------------------------+

Marco.Eichelberg@arbi.informatik.uni-oldenburg.de (Marco Eichelberg) (06/28/91)

lion@dat1hb.north.de (Daniel Tietze) writes:


>  I have a question about using SHARE (as supplied with MS-DOS) with
>Turbo Pascal programs. How can I check SHARE violations in my program?
>What exactly does SHARE do when it encounters a sharing violation? I
>believe the IOResult is set to an appropriate value, but I don't
>know exactly which result is to be expected.
[...]

The only "interface" from TURBO-PASCAL to SHARE.EXE is the
global variable FILEMODE. The default is FileMode=2, which
means "exclusive read/write". By setting this variable to a
appropriate value (i don`t have my manuals with me, so I can`t
tell you right now) you can open a variable for "multiple read"
or even "multiple read/write" access and enable multi-user
processing (at least on LANs). If share finds a access violation,
you will simply get a DOS error code (IOResult=62 ??).
You could trap this using {$I-}, or else you will get a
runtime error. You have to program multiple retries to locked
files yourself, DOS does not care about this.
Hope this helps.

Best Regards
-- 
=========================================================================       
Marco Eichelberg,   Auf dem Braakland 3,  D-W2875 Bookholzberg,   Germany
Phone: +49 4223 2726 (08.00 - 18.00 MET)    UUCP  : eichelberg@uniol.uucp       
Fax  : +49 4223 8322                        ZNet  :  eichelberg@uniol.zer       
Inhouse : meichel!faramir                   Bitnet:     249565 AT DOLUNI1
Domain (Internet) :     Marco.Eichelberg@arbi.informatik.uni-oldenburg.de       
=========================================================================