Merge branch 'MaitreDede-lib-signals'

This commit is contained in:
joan 2018-02-04 09:49:13 +00:00
commit 59f63d832a
3 changed files with 13 additions and 6 deletions

View File

@ -40,6 +40,8 @@ mandir = $(prefix)/man
all: $(ALL)
lib: $(LIB)
pigpio.o: pigpio.c pigpio.h command.h custom.cext
$(CC) $(CFLAGS) -fpic -c -o pigpio.o pigpio.c

View File

@ -203,7 +203,8 @@ bit 0 READ_LAST_NOT_SET_ERROR
#define DO_DBG(level, format, arg...) \
{ \
if (gpioCfg.dbgLevel >= level) \
if (gpioCfg.dbgLevel >= level && \
(gpioCfg.internals & PI_CFG_SIGHANDLER)) \
fprintf(stderr, "%s %s: " format "\n" , \
myTimeStamp(), __FUNCTION__ , ## arg); \
}
@ -1344,7 +1345,7 @@ static volatile gpioCfg_t gpioCfg =
PI_DEFAULT_MEM_ALLOC_MODE,
0, /* dbgLevel */
0, /* alertFreq */
0, /* internals */
PI_CFG_SIGHANDLER, /* internals */
};
/* no initialisation required */
@ -8113,7 +8114,8 @@ int initInitialise(void)
}
#ifndef EMBEDDED_IN_VM
sigSetHandler();
if(gpioCfg.internals & PI_CFG_SIGHANDLER)
sigSetHandler();
#endif
if (initPeripherals() < 0) return PI_INIT_FAILED;
@ -8510,7 +8512,8 @@ void gpioTerminate(void)
if (dmaReg != MAP_FAILED) dmaOut[DMA_CS] = DMA_CHANNEL_RESET;
#ifndef EMBEDDED_IN_VM
if (gpioCfg.internals & PI_CFG_STATS)
if ((gpioCfg.internals & PI_CFG_STATS) &&
(gpioCfg.internals & PI_CFG_SIGHANDLER))
{
fprintf(stderr,
"\n#####################################################\n");
@ -8543,8 +8546,8 @@ void gpioTerminate(void)
fprintf(stderr,
"\n#####################################################\n\n\n");
}
#endif
#endif
initReleaseResources();
fflush(NULL);

View File

@ -865,8 +865,10 @@ typedef void *(gpioThreadFunc_t) (void *);
#define PI_CFG_ALERT_FREQ 4 /* bits 4-7 */
#define PI_CFG_RT_PRIORITY (1<<8)
#define PI_CFG_STATS (1<<9)
#define PI_CFG_SIGHANDLER (1<<10)
#define PI_CFG_ILLEGAL_VAL (1<<11)
#define PI_CFG_ILLEGAL_VAL (1<<10)
/* gpioISR */