/* elctr.c --------- Co. E.Benninghaus Pfaffenhoffentstr. 1 78166 Donaueschingen created: 08.09.2000 last Work: 08.09.2000 */ #ifndef __elctr_c #define __elctr_c #include "elctr.h" #include "../strutil.c" #include "../util.c" #include "../keypad.c" #include "elctrif.c" #include "loop.c" #include "config.c" elctrvalues elctr = { 0,0,MNORUN,0,0,EVT_NOTHING, 0,0,0, 0,2, 8,8,8, 20,20,20, 0.0,0.0,0.0, 0, -1,-1, 0, 0, 1296000.0, 972000.0, 648000.0, 324000.0, 0.0, 324000.0, 648000.0, 324000.0, 1296000.0, 66.666667, 0,0 }; pthread_t elctrthread; void ctrendall( void ) { elctr.run = 0; sleep(1); endPermissions(); } /* return value makes only sense, if loop started as thread */ int ctrstartall( int threaded ) { if(elctr.run){ return(1); } elctr.pid = getpid(); elctr.uid = getuid(); if( elctr.keypad || ( elctr.iftype == IF_PARALLEL ) ) { if( testPermissions() == 0 ){ return(0); } } if(threaded){ if(pthread_create(&elctrthread, NULL, (void *)&ctrLoop, NULL) != 0 ){ fprintf(stderr,"\nCannot create thread\n"); elctr.run = 0; return(0); } return(1); } else { ctrLoop(NULL); } return(1); } #endif /*__main_c*/