summaryrefslogtreecommitdiff
path: root/indra/llmessage/llbufferstream.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-06-06 23:21:07 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-06-06 23:21:07 -0400
commit89ea7ccfc7fd4c33eab4ad9123141fa40231a00d (patch)
treeaf2083dc9563abc8fa7a97100fc7766044d406e8 /indra/llmessage/llbufferstream.cpp
parent3d1cb7ef111cbd5724262077702e0dc2a3d6998d (diff)
parenta519e34f02b4b2663fe082ba9ad12f1b423669cb (diff)
Automated merge with file:///Users/nat/linden/viewer-maint-1144
Diffstat (limited to 'indra/llmessage/llbufferstream.cpp')
-rw-r--r--indra/llmessage/llbufferstream.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/indra/llmessage/llbufferstream.cpp b/indra/llmessage/llbufferstream.cpp
index 6257983c43..8d8ad05ad5 100644
--- a/indra/llmessage/llbufferstream.cpp
+++ b/indra/llmessage/llbufferstream.cpp
@@ -31,6 +31,7 @@
#include "llbuffer.h"
#include "llmemtype.h"
+#include "llthread.h"
static const S32 DEFAULT_OUTPUT_SEGMENT_SIZE = 1024 * 4;
@@ -62,6 +63,7 @@ int LLBufferStreamBuf::underflow()
return EOF;
}
+ LLMutexLock lock(mBuffer->getMutex());
LLBufferArray::segment_iterator_t iter;
LLBufferArray::segment_iterator_t end = mBuffer->endSegment();
U8* last_pos = (U8*)gptr();
@@ -149,6 +151,7 @@ int LLBufferStreamBuf::overflow(int c)
// since we got here, we have a buffer, and we have a character to
// put on it.
LLBufferArray::segment_iterator_t it;
+ LLMutexLock lock(mBuffer->getMutex());
it = mBuffer->makeSegment(mChannels.out(), DEFAULT_OUTPUT_SEGMENT_SIZE);
if(it != mBuffer->endSegment())
{
@@ -210,6 +213,7 @@ int LLBufferStreamBuf::sync()
// *NOTE: I bet we could just --address if address is not NULL.
// Need to think about that.
+ LLMutexLock lock(mBuffer->getMutex());
address = mBuffer->seek(mChannels.out(), address, -1);
if(address)
{
@@ -273,6 +277,8 @@ streampos LLBufferStreamBuf::seekoff(
// NULL is fine
break;
}
+
+ LLMutexLock lock(mBuffer->getMutex());
address = mBuffer->seek(mChannels.in(), base_addr, off);
if(address)
{
@@ -304,6 +310,8 @@ streampos LLBufferStreamBuf::seekoff(
// NULL is fine
break;
}
+
+ LLMutexLock lock(mBuffer->getMutex());
address = mBuffer->seek(mChannels.out(), base_addr, off);
if(address)
{