/alps/ipecamera

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to data.c

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-22 18:19:17 UTC
  • Revision ID: csa@suren.me-20160322181917-h694t7kf0koiun9y
Fix minor error in rarely used path

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
}
80
80
 
81
81
static int ipecamera_get_next_buffer_to_process(ipecamera_t *ctx, pcilib_event_id_t *evid) {
82
 
    int res;
 
82
    int err, res;
83
83
 
84
84
    if (ctx->preproc_id == ctx->event_id) return -1;
85
85
    
101
101
 
102
102
    res = ctx->preproc_id%ctx->buffer_size;
103
103
 
104
 
    if (pthread_rwlock_trywrlock(&ctx->frame[res].mutex)) {
105
 
        pthread_mutex_unlock(&ctx->preproc_mutex);
106
 
        ipecamera_debug(HARDWARE, "Can't lock buffer %i", res);
 
104
    if ((err = pthread_rwlock_trywrlock(&ctx->frame[res].mutex)) != 0) {
 
105
        if (ctx->preproc)
 
106
            pthread_mutex_unlock(&ctx->preproc_mutex);
 
107
        ipecamera_debug(HARDWARE, "Can't lock buffer %i, errno %i", res, err);
107
108
        return -1;
108
109
    }
109
110