X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FReadMonitor.c;h=5165b81c199a97b1c44e2f577e5ce225b0cfbee5;hp=80a77c7f71815cf2828f9507d1c35363536de0b5;hb=d25090faca15102552d77c38161a8a34b0bac41e;hpb=86daf7e40ebb0b24397b67e1a272100bcccd539a diff --git a/sources/ReadMonitor.c b/sources/ReadMonitor.c index 80a77c7..5165b81 100644 --- a/sources/ReadMonitor.c +++ b/sources/ReadMonitor.c @@ -25,7 +25,7 @@ * * Author: S. Piccardi Jan. 2003 * - * $Id: ReadMonitor.c,v 1.1 2003/01/10 09:28:49 piccardi Exp $ + * $Id: ReadMonitor.c,v 1.5 2003/05/02 09:55:14 piccardi Exp $ * *****************************************************************************/ #include @@ -90,19 +90,13 @@ int main(int argc, char *argv[]) * * ***********************************************************/ /* create needed IPC objects */ - key = ftok("./DirMonitor.c", 1); /* define a key */ - shmid = shmget(key, 4096, 0); /* get a shared memory ID */ - if (shmid < 0) { + key = ftok("~/gapil/sources/DirMonitor.c", 1); /* define a key */ + if (!(shmptr = ShmFind(key, 4096))) { /* get a shared memory segment */ perror("Cannot find shared memory"); exit(1); } - if ( (shmptr = shmat(shmid, NULL, 0)) == NULL ) { /* attach to process */ - perror("Cannot attach segment"); - exit(1); - } if ((mutex = MutexFind(key)) == -1) { /* get the Mutex */ perror("Cannot find mutex"); - exit(1); } /* main loop */ MutexLock(mutex); /* lock shared memory */