11 Commits
Author SHA1 Message Date
Joachim Nilsson de89b6647d Update ChangeLog and bump ABI + release version for v2.1.3 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-06 22:03:16 +02:00
Joachim Nilsson 7eee63e5eb debian: The bare .so symlink should go in the -dev package [Policy]
Clarify rules: libuev.a and libuev.so are for initial linking.  See
Debian Policy sect. 8.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-06 22:02:56 +02:00
Joachim Nilsson c780b82929 Update ChangeLog for upcoming bug fix release v2.1.3
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-05 17:48:50 +02:00
Joachim Nilsson cccaabfad5 Don't call uev_timer_set() when stopping timer, just close() it
The semantics for timerfd in Linux is to use close() to stop,
so no need for the extra overhead with uev_timer_set().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-04 21:22:33 +02:00
Joachim Nilsson 6d33c56d0f Return early and OK if signal watcher is already stopped
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-04 07:16:01 +02:00
Joachim Nilsson 6ae98d135c tests: Restart stopped timer before calling uev_exit()
There's an issue with uftpd not exiting properly.  Cannot nail it down
properly but it seems to be related to the stopping of active timers.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-04 07:11:23 +02:00
Joachim Nilsson d3e5900f73 Refactor, use LIST_FOREACH_SAFE() instead of while() in uev_exit()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-01 18:55:22 +02:00
Joachim Nilsson 2ff15101ae New API test to verify uev_exit() terminates properly
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-01 18:54:56 +02:00
Joachim Nilsson 04d9e1c80a Bump version for next bugfix release cycle
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-01 18:50:30 +02:00
Joachim Nilsson 0674fb8db4 Reminder to investigate for next release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-01 18:50:18 +02:00
Joachim Nilsson c4ac2eae5d Update example, use /dev/input/js0, the first joystick
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-05-31 23:37:39 +02:00
15 changed files with 82 additions and 15 deletions

No files matched your search

+1 -1
View File
@@ -312,7 +312,7 @@ int main(void)
uev_t watcher; uev_t watcher;
uev_ctx_t ctx; uev_ctx_t ctx;
fd = open("/dev/input/js1", O_RDONLY, O_NONBLOCK); fd = open("/dev/input/js0", O_RDONLY, O_NONBLOCK);
if (fd < 0) if (fd < 0)
errx(errno, "Cannot find a joystick attached."); errx(errno, "Cannot find a joystick attached.");
+18 -1
View File
@@ -3,6 +3,22 @@ Change Log
All notable changes to the project are documented in this file. All notable changes to the project are documented in this file.
[v2.1.3][] - 2018-09-06
-----------------------
### Changes
- Update joystick example, use first device, `/dev/input/js0`
- Minor refactor of `uev_exit()`, use `_SAFE` macros to traverse
list of watchers instead of `while()`
- New API test to verify that `uev_exit()` terminates properly
- Make `uev_signal_stop()` idempotent
### Fixes
- Let `uev_timer_stop()` call `close()` on the timerfd directly, do not
call `uev_timer_set()` since that may cause lockups or hangs
[v2.1.2][] - 2018-02-27 [v2.1.2][] - 2018-02-27
----------------------- -----------------------
@@ -350,7 +366,8 @@ v0.0.1 - 2012-03-17
Lua users mailing list. Lua users mailing list.
[UNRELEASED]: https://github.com/troglobit/libuev/compare/v2.1.2...HEAD [UNRELEASED]: https://github.com/troglobit/libuev/compare/v2.1.3...HEAD
[v2.1.3]: https://github.com/troglobit/libuev/compare/v2.1.2...v2.1.3
[v2.1.2]: https://github.com/troglobit/libuev/compare/v2.1.1...v2.1.2 [v2.1.2]: https://github.com/troglobit/libuev/compare/v2.1.1...v2.1.2
[v2.1.1]: https://github.com/troglobit/libuev/compare/v2.1.0...v2.1.1 [v2.1.1]: https://github.com/troglobit/libuev/compare/v2.1.0...v2.1.1
[v2.1.0]: https://github.com/troglobit/libuev/compare/v2.0.0...v2.1.0 [v2.1.0]: https://github.com/troglobit/libuev/compare/v2.0.0...v2.1.0
+1 -1
View File
@@ -1,4 +1,4 @@
AC_INIT(libuev, 2.1.2, https://github.com/troglobit/libuev/issues) AC_INIT(libuev, 2.1.3, https://github.com/troglobit/libuev/issues)
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
+11
View File
@@ -1,3 +1,14 @@
libuev (2.1.3) unstable; urgency=medium
* Minor bugfix release
- Updated joystick example, use first joystick, /dev/input/js0
- Use LIST_FOREACH_SAFE() instead of while() in uev_exit()
- New API test for uev_exit()
- Don't call uev_timer_set() when stopping a timer, may cause lockups
- Return OK immediately if a signal watcher is already stopped
* Packaging fixes: libuev.so symlink goes in -dev package
-- Joachim Nilsson <troglobit@gmail.com> Thu, 06 Sep 2018 22:01:24 +0200
libuev (2.1.2) unstable; urgency=medium libuev (2.1.2) unstable; urgency=medium
* Minor bugfix release * Minor bugfix release
+2 -1
View File
@@ -1,3 +1,4 @@
usr/include/uev/*.h usr/include/uev/*.h
usr/lib/*/lib*.a usr/lib/*/libuev.a
usr/lib/*/libuev.so
usr/lib/*/pkgconfig/lib*.pc usr/lib/*/pkgconfig/lib*.pc
+1 -1
View File
@@ -1 +1 @@
usr/lib/*/lib*.so* usr/lib/*/lib*.so.*
+1 -1
View File
@@ -78,7 +78,7 @@ int main(void)
uev_t js1_watcher; uev_t js1_watcher;
uev_ctx_t ctx; uev_ctx_t ctx;
fd = open("/dev/input/js1", O_RDONLY, O_NONBLOCK); fd = open("/dev/input/js0", O_RDONLY, O_NONBLOCK);
if (fd < 0) if (fd < 0)
errx(errno, "Cannot find a joystick attached."); errx(errno, "Cannot find a joystick attached.");
+1 -1
View File
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libuev.la
libuev_la_SOURCES = uev.c io.c timer.c signal.c cron.c libuev_la_SOURCES = uev.c io.c timer.c signal.c cron.c
libuev_la_CPPFLAGS = -D_GNU_SOURCE -D_TIME_BITS=64 libuev_la_CPPFLAGS = -D_GNU_SOURCE -D_TIME_BITS=64
libuev_la_CFLAGS = -W -Wall -Wextra libuev_la_CFLAGS = -W -Wall -Wextra
libuev_la_LDFLAGS = $(AM_LDFLAGS) -version-info 2:1:0 libuev_la_LDFLAGS = $(AM_LDFLAGS) -version-info 2:2:0
noinst_PROGRAMS = bench noinst_PROGRAMS = bench
bench_CPPFLAGS = -D_GNU_SOURCE bench_CPPFLAGS = -D_GNU_SOURCE
+3
View File
@@ -140,6 +140,9 @@ int uev_signal_start(uev_t *w)
*/ */
int uev_signal_stop(uev_t *w) int uev_signal_stop(uev_t *w)
{ {
if (!_uev_watcher_active(w))
return 0;
if (_uev_watcher_stop(w)) if (_uev_watcher_stop(w))
return -1; return -1;
-5
View File
@@ -170,17 +170,12 @@ int uev_timer_start(uev_t *w)
*/ */
int uev_timer_stop(uev_t *w) int uev_timer_stop(uev_t *w)
{ {
/* Check if already stopped in uev_run() after cb() or _init() */
if (!_uev_watcher_active(w)) if (!_uev_watcher_active(w))
return 0; return 0;
/* Stop kernel timer */
uev_timer_set(w, 0, 0);
if (_uev_watcher_stop(w)) if (_uev_watcher_stop(w))
return -1; return -1;
/* Close timerfd, will have to be reopened again on reset */
close(w->fd); close(w->fd);
w->fd = -1; w->fd = -1;
+4 -3
View File
@@ -203,14 +203,14 @@ int uev_init(uev_ctx_t *ctx)
*/ */
int uev_exit(uev_ctx_t *ctx) int uev_exit(uev_ctx_t *ctx)
{ {
uev_t *w, *next;
if (!ctx) { if (!ctx) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
while (!LIST_EMPTY(&ctx->watchers)) { LIST_FOREACH_SAFE(w, &ctx->watchers, link, next) {
uev_t *w = LIST_FIRST(&ctx->watchers);
/* Remove from internal list */ /* Remove from internal list */
LIST_REMOVE(w, link); LIST_REMOVE(w, link);
@@ -233,6 +233,7 @@ int uev_exit(uev_ctx_t *ctx)
} }
} }
LIST_INIT(&ctx->watchers);
ctx->running = 0; ctx->running = 0;
close(ctx->fd); close(ctx->fd);
ctx->fd = -1; ctx->fd = -1;
+1
View File
@@ -1,6 +1,7 @@
*.trs *.trs
*.log *.log
active active
api
complete complete
cronrun cronrun
signal signal
+1
View File
@@ -3,6 +3,7 @@ CLEANFILES = *~ *.trs *.log
TESTS = TESTS =
TESTS += active TESTS += active
TESTS += api
TESTS += complete TESTS += complete
TESTS += cronrun TESTS += cronrun
TESTS += signal TESTS += signal
+3
View File
@@ -30,6 +30,9 @@ static void cb(uev_t *w, void *UNUSED(arg), int events)
fail_unless(!uev_timer_active(&timer2)); fail_unless(!uev_timer_active(&timer2));
fail_unless(!uev_cron_active(&cron2)); fail_unless(!uev_cron_active(&cron2));
/* Restart timer and see if we fail in uev_exit() */
uev_timer_start(&timer2);
uev_exit(w->ctx); uev_exit(w->ctx);
} }
+34
View File
@@ -0,0 +1,34 @@
#include "check.h"
uev_t timer, file;
int counter = 10;
static void cb(uev_t *w, void *UNUSED(arg), int events)
{
if (UEV_ERROR == events)
fprintf(stderr, "timer watcher failed, ignoring ...\n");
if (counter--)
return;
uev_exit(w->ctx);
}
int main(void)
{
uev_ctx_t ctx;
FILE *fp;
uev_init(&ctx);
uev_timer_init(&ctx, &timer, cb, NULL, 100, 100);
fp = fopen("/dev/one", "r");
if (fp)
uev_io_init(&ctx, &file, cb, NULL, fileno(fp), UEV_READ);
uev_run(&ctx, 0);
uev_exit(&ctx); /* Should not hang event loop, troglobit/uftpd#16 */
return 0;
}