[futurebasic] Re: Do handles to resources need to be locked?

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

From: WarMaster <dereksmi@...>
Date: Mon, 26 Jan 1998 10:51:33 -1000
>   I was looking over some code in my program and all of a sudden I got
> nervous. The following bit of code works, but should I be locking resHand&
> before copying data from it? 
> 
> resHand&=FN GETRESOURCE(_"GeoJ",id)
>   err% = SYSERROR
>   siz&	=	FN GETHANDLESIZE(resHand&)
>   LONG IF resHand& <>0 and err%=_false                              'NOT err%
>     CALL SETRESLOAD(_True)
>     CALL LOADRESOURCE(resHand&)
>     adr&=PEEK LONG (resHand&)
>     recAdr&=@gGrad
>     BLOCKMOVE adr&, recAdr&, _bSz
>    END IF
>   CALL RELEASERESOURCE(resHand&)


Yes, it is a very wise move.  If the resource should move, you won't crash
but will instead blockmove a bunch of garbage into adr&.  Lock that
sucker.

-Derek
----------------
www2.hawaii.edu/~dereksmi
----------------