[Sysfence-commit] sysfence mainloop.c,1.7,1.8
Status: Alpha
Brought to you by:
emes
|
From: mkoperto <mko...@us...> - 2004-05-20 14:37:47
|
Update of /cvsroot/sysfence/sysfence In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23246/sysfence Modified Files: mainloop.c Log Message: change: mutex -> semaphore Index: mainloop.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/mainloop.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- mainloop.c 1 Mar 2004 17:28:10 -0000 1.7 +++ mainloop.c 20 May 2004 14:37:37 -0000 1.8 @@ -17,13 +17,13 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <pthread.h> #include "parseopt/lex.h" #include "getstats.h" #include "conditions.h" #include "log.h" +#include "communication.h" +#include "mainloop.h" -pthread_mutex_t changing_data; int step = 10; void rule_watch_loop (ruleset *rule) @@ -32,10 +32,10 @@ /* save result of this and previous hit */ rule->prevhit = rule->hit; - /* lock mutex while checking data */ - pthread_mutex_lock (&changing_data); + /* set semaphore while checking data */ + semaphore_wait (semid); rule->hit = check_expression (rule->expr); - pthread_mutex_unlock (&changing_data); + semaphore_post (semid); if (rule->hit) { #ifdef DEBUG @@ -75,11 +75,11 @@ { while (1) { - /* lock mutex while changing data */ - pthread_mutex_lock (&changing_data); + /* set semaphore while changing data */ + semaphore_wait (semid); fetch_la (); fetch_mem (); - pthread_mutex_unlock (&changing_data); + semaphore_post (semid); sleep (step); } |