From 922c7262b229585fbedc0075f6eb504b0c50c06f Mon Sep 17 00:00:00 2001 From: gabigutu Date: Fri, 17 Oct 2025 09:44:20 +0300 Subject: [PATCH] Thread Function Performs Multiple Incrementations --- laboratoare/lab02/mutex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/laboratoare/lab02/mutex.c b/laboratoare/lab02/mutex.c index af5d79d..c0b2259 100755 --- a/laboratoare/lab02/mutex.c +++ b/laboratoare/lab02/mutex.c @@ -3,13 +3,15 @@ #include #define NUM_THREADS 2 +#define NUM_REPEAT 1000 int a = 0; // TODO: adaugati mutexul in functia de mai jos void *f(void *arg) { - a += 2; + for (int i = 0; i < NUM_REPEAT; i++) + a += 2; pthread_exit(NULL); }