ssCore.BinaryFile.unlock

Release a previously obtained exclusive lock.


Availability:

First available in version 3.7 build 197.


Input Parameters:

None.


Output Parameters:

systemError - A system specific error code from the GetLastError function.


Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.BinaryFile.unlock( paramsObject [, callbackParamsObject] [, errorParamsObject] );


Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.BinaryFile.unlock( paramsObject );


Notes:

If your application terminates without unlocking a file or closes a file that is locked, the behavior is undefined. The plugin will prevent you from closing a file before you unlock it by returning an error. The plugin will attempt to release locks if the application terminates unexpectedly.

                

Examples:

Create a new file and attempt to lock it for exclusive access to prevent other processes from accessing it while we work with it.

ssCore.BinaryFile.create({path:"startdir://test.dat", accessMode:"write", failIfExists:"false"});

var r:Object = ssCore.BinaryFile.lock({});

if (r.success)
{
    ssCore.BinaryFile.writeBytes({data:"i am the data", format:"utf8"});
    // we must unlock the file before closing it, or the call to close will fail.
    ssCore.BinaryFile.unlock({});
}

ssCore.BinaryFile.close({});