Skip to content
Snippets Groups Projects
Commit 87dd54d8 authored by rswindell's avatar rswindell
Browse files

Test multiple locks of same region from same process/thread.

parent 986e4c6f
Branches
Tags
No related merge requests found
...@@ -91,10 +91,14 @@ int main() ...@@ -91,10 +91,14 @@ int main()
return(errno); return(errno);
} }
write(fd,"lock testing\n",LOCK_LEN); write(fd,"lock testing\n",LOCK_LEN);
if(lock(fd,LOCK_OFFSET,LOCK_LEN)) if(lock(fd,LOCK_OFFSET,LOCK_LEN)==0)
printf("lock() succeeds\n");
else
printf("!FAILURE lock() non-functional (or file already locked)\n"); printf("!FAILURE lock() non-functional (or file already locked)\n");
if(lock(fd,LOCK_OFFSET,LOCK_LEN)==0)
printf("Subsequent lock succeeded\n");
else else
printf("lock() succeeds\n"); perror("!Subsequent lock of "LOCK_FNAME);
if(_beginthread( if(_beginthread(
lock_test_thread /* entry point */ lock_test_thread /* entry point */
,0 /* stack size (0=auto) */ ,0 /* stack size (0=auto) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment