- make pollcat_loop() work as expected with no structs linked, by - calling usleep() instead of poll() - refactoring delay calculation and reset into pollcat_time_value() - simplify pollcat_timer_dispatch() in case of slow callbacks - deprecate pollcat_timer_dispatch_thresh - revise tests/timer.c to support two new options: - -s to monitor stdin with pollcat_fd_add() - -w to use pollcat_loop() instead of handling main-loop separately - make pollcat_dump() always present in header, since it's always compiled in - add Makefile rules for installing tests, for easier running on cross-compiled targets
48 lines
1.9 KiB
C
48 lines
1.9 KiB
C
/** Private includes
|
|
*
|
|
* This file is part of the Pollcat Library.
|
|
* Copyright (C) 2022,2025 Expatria Technologies Inc.
|
|
* Contact: Morgan Hughes <morgan@expatria.ca>
|
|
*
|
|
* The Pollcat Library is free software: you can redistribute it and/or modify it under
|
|
* the terms of the the GNU Lesser General Public License as published by the Free
|
|
* Software Foundation; either version 3 of the License, or (at your option) any later
|
|
* version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received copies of the GNU General Public License and the GNU Lesser
|
|
* General Public License along with the Pollcat Library. If not, see
|
|
* https://www.gnu.org/licenses/
|
|
*
|
|
* vim:ts=4:noexpandtab
|
|
*/
|
|
#ifndef _SRC_PRIVATE_H_
|
|
#define _SRC_PRIVATE_H_
|
|
#include <pollcat.h>
|
|
|
|
|
|
/** Local assert macro */
|
|
#define POLLCAT_ASSERT(test) \
|
|
do { \
|
|
if ( !(test) ) { \
|
|
if ( pollcat_assert_func ) \
|
|
pollcat_assert_func(__FILE__, __LINE__, #test); \
|
|
else if ( stderr ) \
|
|
fprintf(stderr, "%s[%d]: assertion failed: %s (%s)\n", \
|
|
__FILE__, __LINE__, #test, strerror(errno)); \
|
|
abort(); \
|
|
} \
|
|
} while(0)
|
|
|
|
extern pollcat_assert_f pollcat_assert_func;
|
|
|
|
|
|
/** Return the current timeout and reset the current timeout to the base value */
|
|
int pollcat_time_value (void);
|
|
|
|
|
|
#endif /* _SRC_PRIVATE_H_ */
|