int LockMutex(int fd)
{
struct flock lock; /* file lock structure */
- /* set flock structure */
lock.l_type = F_WRLCK; /* set type: read or write */
lock.l_whence = SEEK_SET; /* start from the beginning of the file */
lock.l_start = 0; /* set the start of the locked region */
int UnlockMutex(int fd)
{
struct flock lock; /* file lock structure */
- /* set flock structure */
lock.l_type = F_UNLCK; /* set type: unlock */
lock.l_whence = SEEK_SET; /* start from the beginning of the file */
lock.l_start = 0; /* set the start of the locked region */
{
int res;
struct flock lock; /* file lock structure */
- /* set flock structure */
lock.l_type = F_WRLCK; /* set type: unlock */
lock.l_whence = SEEK_SET; /* start from the beginning of the file */
lock.l_start = 0; /* set the start of the locked region */