[futurebasic] Re: [FB] [FB^3] HLOCK

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1999 : Group Archive : Group : All Groups

From: Derek Smith <dereksmi@...>
Date: Fri, 26 Nov 1999 01:36:59 -1000
On Fri, 26 Nov 1999, Richard Phillips wrote:

>  
> > ignore% = HLOCK(hndl&)
> > Does this mean I'm suppose to "ignore"
> > and not check for error...
>  
>     My understanding is that if we assume the handle to be valid from the
> start, then the locking and unlocking of the handle is all but failure proof. 
> This is because all that "HLOCK" and "HUNLOCK" do is toggle a bit.  So the
> thinking goes (I suppose), if your program discovers an "HLOCK" or "HUNLOCK"
> error, then the cause of the problem is something that really should have been
> caught earlier.

This is basically true but you've got to take it a bit farther when
dealing with the result.  The result is nearly always a totally random
value in PPC.  I'm not sure why FB HLock returns anything at all, as no C
code that uses it returns a value (unless my memory is faulty, been known
to happen).

Suffice it to say, checking the return value will cause your program to
malfunction, thinking its found errors when the results are totally
random.

This is why you often see it like:

dontCare = Fn HLock(h)

because you honestly shouldn't care what it returns. 

One interesting note is that in PowerPC mode, you don't even have to
bother with the return var.

Fn HLock(h)

This is because the values are returned in a register and the stack won't
be messed up.


-Derek