diff options
| author | Henrik Rydberg <rydberg@bitmath.org> | 2010-08-04 16:22:40 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-08-05 22:48:38 +0200 |
| commit | 642d7ee26f347152a106d48ddad37a8059d36fb1 (patch) | |
| tree | 86b1c858bc412b1e57131891dd8a2d97dff8aca3 /src/grail-api.c | |
| parent | d07c43f9f19dc0ee38aaf44947cfc396f437490e (diff) | |
Fix hanging event bug
The no-wait approach, where events are read and process asynchronously,
resulted in spurious events getting stuck in the input queue. This
patch reverts the behavior to synchronous buffer read and processing,
resolving the problem for now.
Signed-off-by: Henrik Rydberg <rydberg@bitmath.org>
Diffstat (limited to 'src/grail-api.c')
| -rw-r--r-- | src/grail-api.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/grail-api.c b/src/grail-api.c index cbd2da4..c4a88df 100644 --- a/src/grail-api.c +++ b/src/grail-api.c | |||
| @@ -46,9 +46,9 @@ static void *grail_thread(void *priv) | |||
| 46 | pull = x->pull; | 46 | pull = x->pull; |
| 47 | finished = x->finished; | 47 | finished = x->finished; |
| 48 | x->pull = 0; | 48 | x->pull = 0; |
| 49 | pthread_mutex_unlock(&x->mutex); | ||
| 50 | if (!finished && pull) | 49 | if (!finished && pull) |
| 51 | touch_dev_process(&x->dev); | 50 | touch_dev_process(&x->dev); |
| 51 | pthread_mutex_unlock(&x->mutex); | ||
| 52 | } | 52 | } |
| 53 | pthread_exit(NULL); | 53 | pthread_exit(NULL); |
| 54 | } | 54 | } |
| @@ -161,10 +161,9 @@ int grail_idle(struct grail *ge, int fd, int ms) | |||
| 161 | int grail_pull(struct grail *ge, int fd) | 161 | int grail_pull(struct grail *ge, int fd) |
| 162 | { | 162 | { |
| 163 | struct grail_impl *x = ge->impl; | 163 | struct grail_impl *x = ge->impl; |
| 164 | int finished = touch_dev_fetch(&x->dev, fd) < 0; | ||
| 165 | pthread_mutex_lock(&x->mutex); | 164 | pthread_mutex_lock(&x->mutex); |
| 166 | x->pull = 1; | 165 | x->pull = 1; |
| 167 | x->finished = finished; | 166 | x->finished = touch_dev_fetch(&x->dev, fd) < 0; |
| 168 | pthread_cond_signal(&x->wait); | 167 | pthread_cond_signal(&x->wait); |
| 169 | pthread_mutex_unlock(&x->mutex); | 168 | pthread_mutex_unlock(&x->mutex); |
| 170 | return 1; | 169 | return 1; |
