+ *
+ * @return ressource the semaphore key
+ */
+ private static function semaphoreKey($fn_name)
+ {
+ $temp = get_temppath();
+
+ $file = $temp.'/'.$fn_name.'.sem';
+
+ if (!file_exists($file)) {
+ file_put_contents($file, $fn_name);
+ }
+
+ return ftok($file, 'f');
+ }
+
+ /**
+ * @brief Sets a lock for a given name
+ *
+ * @param string $fn_name Name of the lock