2018-04-11 15:36:12 +02:00
|
|
|
# ----------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# Lock Exports
|
|
|
|
# ----------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
MODULE = pgBackRest::LibC PACKAGE = pgBackRest::LibC
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
bool
|
|
|
|
lockAcquire(lockPath, command, stanza, lockTimeout, failOnNoLock)
|
|
|
|
const char *lockPath
|
|
|
|
const char *command
|
|
|
|
const char *stanza
|
|
|
|
double lockTimeout
|
|
|
|
bool failOnNoLock
|
|
|
|
CODE:
|
|
|
|
RETVAL = false;
|
|
|
|
|
|
|
|
MEM_CONTEXT_XS_TEMP_BEGIN()
|
|
|
|
{
|
|
|
|
// Set the command so we can get the correct lock type to use
|
|
|
|
cfgCommandSet(cfgCommandId(command));
|
|
|
|
|
|
|
|
// Attempt to acquire the lock
|
2018-05-21 16:46:45 +02:00
|
|
|
if (cfgLockRequired())
|
2018-11-08 15:37:57 +02:00
|
|
|
RETVAL = lockAcquire(strNew(lockPath), strNew(stanza), cfgLockType(), (TimeMSec)(lockTimeout * 1000), failOnNoLock);
|
2018-04-11 15:36:12 +02:00
|
|
|
}
|
|
|
|
MEM_CONTEXT_XS_TEMP_END();
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
bool
|
|
|
|
lockRelease(failOnNoLock)
|
|
|
|
bool failOnNoLock
|
|
|
|
CODE:
|
|
|
|
RETVAL = false;
|
|
|
|
|
|
|
|
MEM_CONTEXT_XS_TEMP_BEGIN()
|
|
|
|
{
|
|
|
|
RETVAL = lockRelease(failOnNoLock);
|
|
|
|
}
|
|
|
|
MEM_CONTEXT_XS_TEMP_END();
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|