Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/* lockfile.c - check lock by trying to create a lock file */
/* From the man page for "open" */
/* Compile: [g]cc lockfile.c -o lockfile */
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#define LOCKFILE "/tmp/mylockfile"
int main(int argc, char ** argv)
{
exit( open(LOCKFILE, O_WRONLY | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1 );
}
#!/bin/ksh
while ( ! lockfile )
do
print "Didn't get lock, waiting: $(date)"
sleep 5
done
# You got the lock, do what you want to with the resource
print "GOT THE LOCK! $(date)"
# Remove the lock file when done so others can play
rm /tmp/mylockfile