mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-23 11:24:34 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de89b6647d | ||
|
|
7eee63e5eb | ||
|
|
c780b82929 | ||
|
|
cccaabfad5 | ||
|
|
6d33c56d0f | ||
|
|
6ae98d135c | ||
|
|
d3e5900f73 | ||
|
|
2ff15101ae | ||
|
|
04d9e1c80a | ||
|
|
0674fb8db4 | ||
|
|
c4ac2eae5d |
No files matched your search
@@ -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
@@ -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
@@ -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])
|
||||||
|
|
||||||
|
|||||||
Vendored
+11
@@ -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
|
||||||
|
|||||||
Vendored
+2
-1
@@ -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
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
usr/lib/*/lib*.so*
|
usr/lib/*/lib*.so.*
|
||||||
+1
-1
@@ -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
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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,6 +1,7 @@
|
|||||||
*.trs
|
*.trs
|
||||||
*.log
|
*.log
|
||||||
active
|
active
|
||||||
|
api
|
||||||
complete
|
complete
|
||||||
cronrun
|
cronrun
|
||||||
signal
|
signal
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
@@ -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;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user