summaryrefslogtreecommitdiffstats
path: root/Under-Testing/Website/mutexFunctions.php
diff options
context:
space:
mode:
authorgsmselftest2011-11-16 18:06:02 +0100
committergsmselftest2011-11-16 18:06:02 +0100
commit8a7755d6f96e599fe75ac8e5e1c6994138f4b99e (patch)
tree9b320feb695cfbadd605808b2db5795e240e9399 /Under-Testing/Website/mutexFunctions.php
parent delete dummy comment (diff)
downloadgsm-selftest-8a7755d6f96e599fe75ac8e5e1c6994138f4b99e.tar.gz
gsm-selftest-8a7755d6f96e599fe75ac8e5e1c6994138f4b99e.tar.xz
gsm-selftest-8a7755d6f96e599fe75ac8e5e1c6994138f4b99e.zip
under Testing folder
Diffstat (limited to 'Under-Testing/Website/mutexFunctions.php')
-rw-r--r--Under-Testing/Website/mutexFunctions.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/Under-Testing/Website/mutexFunctions.php b/Under-Testing/Website/mutexFunctions.php
new file mode 100644
index 0000000..af45610
--- /dev/null
+++ b/Under-Testing/Website/mutexFunctions.php
@@ -0,0 +1,36 @@
+<?
+//Mutex functions
+function Lock($lockName,$seconds)
+{
+ $sql = "SELECT GET_LOCK('$lockName', $seconds);";
+ $res = mysql_query($sql);
+ if (!$res)
+ {
+ die('Could not query:' . mysql_error());
+ }
+ return mysql_result($res,0);
+}
+
+function IsLocked($lockName)
+{
+ $sql = "SELECT IS_FREE_LOCK('$lockName');";
+ $res = mysql_query($sql);
+ if (!$res)
+ {
+ die('Could not query:' . mysql_error());
+ }
+ return mysql_result($res,0);
+}
+
+function ReleaseLock($lockName)
+{
+ $sql = "SELECT RELEASE_LOCK('$lockName');";
+ $res = mysql_query($sql);
+ if (!$res)
+ {
+ die('Could not query:' . mysql_error());
+ }
+ return mysql_result($res,0);
+}
+//End of mutex functions
+?>