TIP: Click on subject to list as thread! ANSI
echo: foxpro
to: DISEN ABELLA
from: RANDY W FOGG
date: 1997-04-21 08:37:00
subject: FP 2.5/DOS AND NOVELL 3.11

 > Ok. Why not tell me more about 'deadly embrace' and how to 
 > avoid/circumvent it?
Deadly embrace occurs when multiple users attempt accessing the same 
record(s) causing a loop or 'deadly embrace'. For example, User A is 
currently working on Record 10 and user B is on Record 11. User B tries to 
move to Record 10 as user A tries to move to Record 11. With automatic record 
locking, the infinite retries will cause the system(s) to hang as both 
records are in use. 
I don't not use Foxpro's 'SET REPROCESS' command at all as I like to control 
all locking at a programmatic level using RLOCK() and FLOCK(). For example:
 if rlock()
    replace next 1 LASTNAME with "SMITH"
 else
   Wait Window "Record is in use...try later"
 endif
 This is quite rudimentary but gives you the idea. Another thing you have to 
remember is certain commands like PACK and REINDEX require EXCLUSIVE use of a 
file. A simple FLOCK() won't do it. So, I have built routines that will Save 
the current file stats (recno(), index tag, etc), close the file, open it 
exclusively, do the routine, the close and open again with EXCLUSIVE off.
Another point that should be looked at is HOW records are currently locked. 
For instance I RARELY use append or append blank because both require not 
only a record lock, but also lock the database header momentarily to update 
record counts etc. This, if used with automatic locking, can also lead to the 
dreaded loop. I never truly delete records, simply blank all fields (scatter 
memvar blank, Gather memvar blank) and mark for deletion. Then when needing 
to add a new record, I set the index order to DELETED(), GO TOP to find an 
unused record, Lock it, and begin editing. Looks like a new record to the end 
user but no header locking took place.
Another point to make... I have learned throughout the years that any system 
I design and implement, eventually needs to become multi-user due to the 
changes of my clients. Of course, multi-user systems cost more , so I 
have no problem with this. However, I have learned to develop ALL my code in 
multi-user format, even for single systems. Then at the top of my code I have 
a SET EXCLUSIVE ON. Then when a user requests (and eventually they will) to 
go multi-user on the system I simply change it to SET EXCLUSIVE OFF, 
recompile, and invoice them. .
I hope this helps a little...Any more questions, just shout.
Randy W Fogg
BDK Technologies
randy@bdktech.com
--- FLAME v1.1
---------------
* Origin: 24th Street Exchange * A BBS Since 1983 * 916.448.2483 (1:203/52)

SOURCE: echomail via exec-pc

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™.