From 0ddeed6f226391047acd6bf7ef518947e24638c8 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Thu, 16 Jun 2016 00:56:19 +0200 Subject: [PATCH] locks: sleeping after getting lock --- locks/fcntllocks.c | 6 ++++-- locks/flocks.c | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/locks/fcntllocks.c b/locks/fcntllocks.c index 39b182d..34fc7de 100644 --- a/locks/fcntllocks.c +++ b/locks/fcntllocks.c @@ -173,10 +173,12 @@ void *thread_lock(void * arg) print_with_date (stderr, "Thread %d: F_WRLCK/F_SETLKW, exclusive lock error", threadNumber, strerror(errno)); goto end; } - print_with_date (stdout, "Thread %d: after lock\n", threadNumber); + sleep(3); - sleep(5); + print_with_date (stdout, "Thread %d: after lock\n", threadNumber); + + sleep(3); print_with_date(stdout, "Thread %d: before release lock\n", threadNumber); diff --git a/locks/flocks.c b/locks/flocks.c index f2f0b6e..ae82e2a 100644 --- a/locks/flocks.c +++ b/locks/flocks.c @@ -167,10 +167,13 @@ void *thread_lock(void * arg) print_with_date (stderr, "Thread %d: flock get exclusive lock error", threadNumber, strerror(errno)); goto end; } - print_with_date (stdout, "Thread %d: after lock\n", threadNumber); - sleep(5); + sleep(3); + + print_with_date (stdout, "Thread %d: after lock\n", threadNumber); + + sleep(3); print_with_date(stdout, "Thread %d: before release lock\n", threadNumber); -- 2.1.4