Description:
Add a new LOCK type ( very similar to GET_LOCK() ) that will lock a string but only while the lock has scope. As soon as the scope is lost the lock is automatically released. It should work exactly like the boost library "Scoped Lock".
How to repeat:
EXAMPLE IMPLEMENTATIONS
----------------------
BEGIN
DECLARE mLock BOOLEAN DEFAULT FALSE;
//This will lock the mutex
SET mLock = GET_SCOPED_LOCK( "StringKey", 10 );
//Some code
//The scoped lock will be automatically be unlocked here
END;
BEGIN
DECLARE mLock BOOLEAN DEFAULT FALSE;
//Some code
IF SomeCondiditon = TRUE THEN
BEGIN
//This will lock the mutex
SET mLock = GET_SCOPED_LOCK( "StringKey", 10 );
//Some code
//The scoped lock will be automatically be unlocked here
END;
//Some code
MyLoop: LOOP
//Some code
IF SomeCondiditon = TRUE THEN
BEGIN
//This will lock the mutex
SET mLock = GET_SCOPED_LOCK( "StringKey", 10 );
//Some code
//The scoped lock will be automatically be unlocked here
END;
END LOOP: MyLoop
END;
Suggested fix:
See "Scoped Lock" at http://www.boost.org/doc/libs/1_38_0/doc/html/interprocess/synchronization_mechanisms.html...)
for implementation.