timeshift: minor addition to atomics (check max size correctly).
This commit is contained in:
parent
79c134f9c4
commit
5c4c611e59
3 changed files with 13 additions and 2 deletions
12
src/atomic.h
12
src/atomic.h
|
@ -35,3 +35,15 @@ atomic_add_u64(volatile uint64_t *ptr, uint64_t incr)
|
|||
{
|
||||
return __sync_fetch_and_add(ptr, incr);
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
atomic_pre_add_u64(volatile uint64_t *ptr, uint64_t incr)
|
||||
{
|
||||
return __sync_add_and_fetch(ptr, incr);
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
atomic_pre_add_u64(volatile uint64_t *ptr, uint64_t incr)
|
||||
{
|
||||
return __sync_add_and_fetch(ptr, incr);
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ timeshift_file_t *timeshift_filemgr_get ( timeshift_t *ts, int create )
|
|||
|
||||
/* Check size */
|
||||
if (!timeshift_unlimited_size &&
|
||||
atomic_add_u64(×hift_total_size, 0) >= timeshift_max_size) {
|
||||
atomic_pre_add_u64(×hift_total_size, 0) >= timeshift_max_size) {
|
||||
tvhlog(LOG_DEBUG, "timshift", "ts %d buffer full", ts->id);
|
||||
ts->full = 1;
|
||||
}
|
||||
|
|
|
@ -356,7 +356,6 @@ static int _timeshift_read
|
|||
} else {
|
||||
streaming_message_t *ssm = _timeshift_find_sstart(*cur_file, (*sm)->sm_time);
|
||||
if (ssm && ssm->sm_data != ts->smt_start) {
|
||||
printf("SENDING NEW SMT_START MESSAGE\n");
|
||||
streaming_target_deliver2(ts->output, streaming_msg_clone(ssm));
|
||||
if (ts->smt_start)
|
||||
streaming_start_unref(ts->smt_start);
|
||||
|
|
Loading…
Add table
Reference in a new issue