diff options
Diffstat (limited to 'src')
| -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; |
