void SDIFbuffer_timeShift(SDIFBuffer *x) {
SDIFBufferPrivate *privateStuff = (SDIFBufferPrivate *) x->internal;
SDIFbuf_TimeShiftToZero(privateStuff->buf);
}
// ----->
SDIFresult SDIFbuf_TimeShiftToZero(SDIFbuf_Buffer b)
{
SDIFmem_Frame f;
sdif_float64 tMin;
if(!(f = SDIFbuf_GetFirstFrame(b)))
// no frames in buffer -- we're done
return ESDIF_SUCCESS;
tMin = f->header.time;
// this loop couldn't be any less thread safe
while(f)
{
f->header.time -= tMin;
f = SDIFbuf_GetNextFrame(f);
}
return ESDIF_SUCCESS;
}
The comment this loop couldn't be any less thread safe is obviously concerning; we should evaluate whether or not we should employ something like a thread lock here.
The comment
this loop couldn't be any less thread safe
is obviously concerning; we should evaluate whether or not we should employ something like a thread lock here.