summaryrefslogtreecommitdiffstats
path: root/include/lem.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lem.h')
-rw-r--r--include/lem.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/lem.h b/include/lem.h
index 2b548b8..9277c3e 100644
--- a/include/lem.h
+++ b/include/lem.h
@@ -22,6 +22,7 @@
#include <ev.h>
#include <lua.h>
#include <lauxlib.h>
+#include <unistd.h>
/* Support gcc's __FUNCTION__ for people using other compilers */
#if !defined(__GNUC__) && !defined(__FUNCTION__)
@@ -38,9 +39,9 @@
#define lem_debug(...)
#else
#define lem_debug(fmt, ...) do { \
- printf("%s (%s:%u): " fmt "\n", \
+ lem_dprintf(STDOUT_FILENO, "%s (%s:%u): " fmt "\n", \
__FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__); \
- fflush(stdout); } while (0)
+ } while (0)
#endif
#if EV_MINPRI == EV_MAXPRI
@@ -72,6 +73,7 @@ void lem_queue(lua_State *T, int nargs);
void lem_exit(int status);
void lem_async_run(struct lem_async *a);
void lem_async_config(int delay, int min, int max);
+void lem_dprintf(int fd, const char *format, ...);
static inline void
lem_async_do(struct lem_async *a,