Hi all....

This is a bit of a fundamental question here but I think I only barely
grasp how this whole Locking and Unlocking chunks is all about, not
to mention I'm a newbie programmer. :\

I realize you need to set aside a block or "chunk" of memory before
assigning a variable any value but it's the how in some scenarios that
is messing me up... anyways... I hope this isn't too much of a C question
as it is a Palm Dev Forum question.....

My function calls to the database for a particular record. The problem is
I'm trying to unpack it to my struct (onOrder) but I'm getting a "Chunk
under-locked" error.

So, how do I lock the chunk while passing it through the function....?!?!
My function definition below...

 static Err GetOrderRecord(DmOpenRef *dmReftoSync, UInt16 recordNum,
OnOrder *onOrder)
{
     Err err = 0;
     MemHandle myRecord = DmGetRecord(dmReftoSync, recordNum);

     if(!myRecord)
          err = DmGetLastErr();
     else
     {
          UnpackOnOrder(onOrder, (PackedOnOrder *)
MemHandleLock(myRecord));
          MemHandleUnlock(myRecord);
     }
     MemHandleUnlock(myRecord);
     return err;
}


Nole Mailey
Data Conversion Specialist
ProfitMaster Canada
1.800.340.4492
www.pmcanada.com
[EMAIL PROTECTED]



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to