I guess you can use the base Class for the locking and unlocking....

CMutex zlock;

zlock.Lock

and zlock.Unlock..... if it does not work out let me know...