diff options
| author | Henrik Rydberg <rydberg@bitmath.org> | 2010-07-30 15:29:38 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-05 22:48:38 +0200 |
| commit | 342a43e7b2ceec1dd200bffa24b052fec33f5bdc (patch) | |
| tree | 291938b98037efe6e0def19e7457b9a947c484f1 /test | |
| parent | e0eb1015bf30fd0913db571b000ba6a83ea22660 (diff) | |
Introduce threading
In order to enable deferred events from grail, but the event
processing in a separate thread, and have the calling thread return
as quickly as possible.
Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
Diffstat (limited to 'test')
| -rw-r--r-- | test/grail.c | 4 | ||||
| -rw-r--r-- | test/touch.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/test/grail.c b/test/grail.c index 85c5bd4..361fd22 100644 --- a/test/grail.c +++ b/test/grail.c | |||
| @@ -57,8 +57,10 @@ static void tp_gesture(struct grail *ge, const struct grail_event *ev) | |||
| 57 | 57 | ||
| 58 | static void loop_device(struct grail *ge, int fd) | 58 | static void loop_device(struct grail *ge, int fd) |
| 59 | { | 59 | { |
| 60 | while (!grail_idle(ge, fd, 5000)) | 60 | while (!grail_idle(ge, fd, 5000)) { |
| 61 | grail_pull(ge, fd); | 61 | grail_pull(ge, fd); |
| 62 | fprintf(stderr, "launched\n"); | ||
| 63 | } | ||
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |
diff --git a/test/touch.c b/test/touch.c index bc10b54..1dd9cd4 100644 --- a/test/touch.c +++ b/test/touch.c | |||
| @@ -53,8 +53,10 @@ static void loop_device(struct touch_dev *dev, int fd) | |||
| 53 | struct touch_engine engine; | 53 | struct touch_engine engine; |
| 54 | touch_engine_init(&engine, tp_event, tp_sync, 0); | 54 | touch_engine_init(&engine, tp_event, tp_sync, 0); |
| 55 | touch_engine_attach(&engine, dev); | 55 | touch_engine_attach(&engine, dev); |
| 56 | while (!touch_dev_idle(dev, fd, 5000)) | 56 | while (!touch_dev_idle(dev, fd, 5000)) { |
| 57 | touch_dev_pull(dev, fd); | 57 | touch_dev_fetch(dev, fd); |
| 58 | touch_dev_process(dev); | ||
| 59 | } | ||
| 58 | touch_engine_detach(&engine, dev); | 60 | touch_engine_detach(&engine, dev); |
| 59 | } | 61 | } |
| 60 | 62 | ||
