diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llcommon/llfixedbuffer.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcommon/llfixedbuffer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/linden/indra/llcommon/llfixedbuffer.cpp b/linden/indra/llcommon/llfixedbuffer.cpp index a819150..e9d6029 100644 --- a/linden/indra/llcommon/llfixedbuffer.cpp +++ b/linden/indra/llcommon/llfixedbuffer.cpp | |||
@@ -16,7 +16,8 @@ | |||
16 | * There are special exceptions to the terms and conditions of the GPL as | 16 | * There are special exceptions to the terms and conditions of the GPL as |
17 | * it is applied to this Source Code. View the full text of the exception | 17 | * it is applied to this Source Code. View the full text of the exception |
18 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 18 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
19 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 19 | * online at |
20 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
20 | * | 21 | * |
21 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
22 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -32,6 +33,7 @@ | |||
32 | #include "llfixedbuffer.h" | 33 | #include "llfixedbuffer.h" |
33 | 34 | ||
34 | LLFixedBuffer::LLFixedBuffer(const U32 max_lines) | 35 | LLFixedBuffer::LLFixedBuffer(const U32 max_lines) |
36 | : mMutex(NULL) | ||
35 | { | 37 | { |
36 | mMaxLines = max_lines; | 38 | mMaxLines = max_lines; |
37 | mTimer.reset(); | 39 | mTimer.reset(); |
@@ -46,9 +48,11 @@ LLFixedBuffer::~LLFixedBuffer() | |||
46 | 48 | ||
47 | void LLFixedBuffer::clear() | 49 | void LLFixedBuffer::clear() |
48 | { | 50 | { |
51 | mMutex.lock() ; | ||
49 | mLines.clear(); | 52 | mLines.clear(); |
50 | mAddTimes.clear(); | 53 | mAddTimes.clear(); |
51 | mLineLengths.clear(); | 54 | mLineLengths.clear(); |
55 | mMutex.unlock() ; | ||
52 | 56 | ||
53 | mTimer.reset(); | 57 | mTimer.reset(); |
54 | } | 58 | } |
@@ -69,9 +73,11 @@ void LLFixedBuffer::addLine(const LLWString& line) | |||
69 | 73 | ||
70 | removeExtraLines(); | 74 | removeExtraLines(); |
71 | 75 | ||
76 | mMutex.lock() ; | ||
72 | mLines.push_back(line); | 77 | mLines.push_back(line); |
73 | mLineLengths.push_back((S32)line.length()); | 78 | mLineLengths.push_back((S32)line.length()); |
74 | mAddTimes.push_back(mTimer.getElapsedTimeF32()); | 79 | mAddTimes.push_back(mTimer.getElapsedTimeF32()); |
80 | mMutex.unlock() ; | ||
75 | } | 81 | } |
76 | 82 | ||
77 | 83 | ||
@@ -85,10 +91,12 @@ void LLFixedBuffer::setMaxLines(S32 max_lines) | |||
85 | 91 | ||
86 | void LLFixedBuffer::removeExtraLines() | 92 | void LLFixedBuffer::removeExtraLines() |
87 | { | 93 | { |
94 | mMutex.lock() ; | ||
88 | while ((S32)mLines.size() > llmax((S32)0, (S32)(mMaxLines - 1))) | 95 | while ((S32)mLines.size() > llmax((S32)0, (S32)(mMaxLines - 1))) |
89 | { | 96 | { |
90 | mLines.pop_front(); | 97 | mLines.pop_front(); |
91 | mAddTimes.pop_front(); | 98 | mAddTimes.pop_front(); |
92 | mLineLengths.pop_front(); | 99 | mLineLengths.pop_front(); |
93 | } | 100 | } |
101 | mMutex.unlock() ; | ||
94 | } | 102 | } |