[futurebasic] Re: [FB] FN HGETSTATE/FN HSETSTATE

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1998 : Group Archive : Group : All Groups

From: Chris <behmc@...>
Date: Wed, 28 Oct 1998 12:58:16 -0500
>jonathan:
>
>>Never call FN HLOCK and FN HUNLOCK on a handle.
>>Instead call FN HGETSTATE, then FN HLOCK then FN HSETSTATE.
>>Those who have had mystery crashes and already been there
>>will nod wisely and say "yay", the others will read on...
>
>Excellent point! However, where do you use HUNLOCK, or was that an ommission?
>
>I specifically don't know, but it seems to make sense that the order
>should be:
>
>   FN HGETSTATE
>   FN HLOCK
>
>   'do read/write or whatever needs locked stuff
>
>   HUNLOCK
>   FN HSETSTATE
>
>Is that correct?
>
>tedd

Nope, his point is that by _not_ using HUNLOCK you leave the handle in
whatever state it was in before you modified it. If you use HLOCK on a
locked handle, no harm done, if you then use HUNLOCK on a handle that was
originally locked you could have problems. HSETSTATE will set the handle to
whatever you got from HGETSTATE, so if it was locked it'll be locked when
you are done, if it was unlocked it'll be unlocked when you are done.

*Chris