Commit 5f03841c authored by michael's avatar michael

Comments to indicate where memory barriers may be needed.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17867 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent e90c60c7
...@@ -91,6 +91,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void ...@@ -91,6 +91,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
memcpy(f->wptr, src, len); memcpy(f->wptr, src, len);
src = (uint8_t*)src + len; src = (uint8_t*)src + len;
} }
// Write memory barrier needed for SMP here in theory
f->wptr += len; f->wptr += len;
if (f->wptr >= f->end) if (f->wptr >= f->end)
f->wptr = f->buffer; f->wptr = f->buffer;
...@@ -103,6 +104,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void ...@@ -103,6 +104,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest) int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest)
{ {
// Read memory barrier needed for SMP here in theory
do { do {
int len = FFMIN(f->end - f->rptr, buf_size); int len = FFMIN(f->end - f->rptr, buf_size);
if(func) func(dest, f->rptr, len); if(func) func(dest, f->rptr, len);
...@@ -110,6 +112,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void ...@@ -110,6 +112,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void
memcpy(dest, f->rptr, len); memcpy(dest, f->rptr, len);
dest = (uint8_t*)dest + len; dest = (uint8_t*)dest + len;
} }
// memory barrier needed for SMP here in theory
av_fifo_drain(f, len); av_fifo_drain(f, len);
buf_size -= len; buf_size -= len;
} while (buf_size > 0); } while (buf_size > 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment