Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
timeshift: remove rdwr_mutex
  • Loading branch information
perexg committed Jan 3, 2016
1 parent 1480391 commit e4788ae
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/timeshift.c
Expand Up @@ -515,7 +515,6 @@ streaming_target_t *timeshift_create
ts->ref_time = 0;
for (i = 0; i < TIMESHIFT_BACKLOG_MAX; i++)
TAILQ_INIT(&ts->backlog[i]);
pthread_mutex_init(&ts->rdwr_mutex, NULL);
pthread_mutex_init(&ts->state_mutex, NULL);

/* Initialise output */
Expand Down
1 change: 0 additions & 1 deletion src/timeshift/private.h
Expand Up @@ -117,7 +117,6 @@ typedef struct timeshift {
pthread_t rd_thread; ///< Reader thread
th_pipe_t rd_pipe; ///< Message passing to reader

pthread_mutex_t rdwr_mutex; ///< Buffer protection
timeshift_file_list_t files; ///< List of files

int vididx; ///< Index of (current) video stream
Expand Down
10 changes: 0 additions & 10 deletions src/timeshift/timeshift_reader.c
Expand Up @@ -343,11 +343,9 @@ static int _timeshift_do_skip

/* Find */
cur_file = *_cur_file;
pthread_mutex_lock(&ts->rdwr_mutex);
end = _timeshift_skip(ts, req_time, last_time,
cur_file, &tsf, _tsi);
tsi = *_tsi;
pthread_mutex_unlock(&ts->rdwr_mutex);
if (tsi)
tvhlog(LOG_DEBUG, "timeshift", "ts %d skip found pkt @ %"PRId64,
ts->id, tsi->time);
Expand Down Expand Up @@ -417,9 +415,7 @@ static int _timeshift_read
if (tsf->rfd >= 0)
close(tsf->rfd);
tsf->rfd = -1;
pthread_mutex_lock(&ts->rdwr_mutex);
*cur_file = tsf = timeshift_filemgr_next(tsf, NULL, 0);
pthread_mutex_unlock(&ts->rdwr_mutex);
if (tsf)
tsf->roff = 0; // reset
*wait = 0;
Expand Down Expand Up @@ -633,7 +629,6 @@ void *timeshift_reader ( void *p )
timeshift_writer_flush(ts);
ts->dobuf = 1;
skip_delivered = 1;
pthread_mutex_lock(&ts->rdwr_mutex);
tmp_file = timeshift_filemgr_newest(ts);
if (tmp_file != NULL) {
i64 = tmp_file->last;
Expand All @@ -650,7 +645,6 @@ void *timeshift_reader ( void *p )
pause_time = i64;
last_time = pause_time;
}
pthread_mutex_unlock(&ts->rdwr_mutex);
}
}

Expand Down Expand Up @@ -695,10 +689,8 @@ void *timeshift_reader ( void *p )

/* Reset */
if (ts->full) {
pthread_mutex_lock(&ts->rdwr_mutex);
timeshift_filemgr_flush(ts, NULL);
ts->full = 0;
pthread_mutex_unlock(&ts->rdwr_mutex);
}

/* Release */
Expand All @@ -721,7 +713,6 @@ void *timeshift_reader ( void *p )

/* Live playback (stage1) */
if (ts->state == TS_LIVE) {
pthread_mutex_lock(&ts->rdwr_mutex);
tmp_file = timeshift_filemgr_newest(ts);
if (tmp_file) {
i64 = tmp_file->last;
Expand All @@ -734,7 +725,6 @@ void *timeshift_reader ( void *p )
last_time = ts->last_time;
}
skip_delivered = 0;
pthread_mutex_unlock(&ts->rdwr_mutex);
}

/* May have failed */
Expand Down
4 changes: 2 additions & 2 deletions src/timeshift/timeshift_writer.c
Expand Up @@ -348,7 +348,7 @@ static void _process_msg
case SMT_START:
case SMT_MPEGTS:
case SMT_PACKET:
pthread_mutex_lock(&ts->rdwr_mutex);
pthread_mutex_lock(&ts->state_mutex);
if ((tsf = timeshift_filemgr_get(ts, sm->sm_time)) && (tsf->wfd >= 0 || tsf->ram)) {
if ((err = _process_msg0(ts, tsf, &sm)) < 0) {
timeshift_filemgr_close(tsf);
Expand All @@ -357,7 +357,7 @@ static void _process_msg
}
tsf->refcount--;
}
pthread_mutex_unlock(&ts->rdwr_mutex);
pthread_mutex_unlock(&ts->state_mutex);
break;
}

Expand Down

0 comments on commit e4788ae

Please sign in to comment.