Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
c7f9c3af
Commit
c7f9c3af
authored
13 years ago
by
Xiaohong Bao
Browse files
Options
Downloads
Plain Diff
Automated merge with
https://bitbucket.org/VirLinden/viewer-development-shining-fixes
parents
c0b4ec6f
4ec112bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/llcommon/llthread.h
+5
-2
5 additions, 2 deletions
indra/llcommon/llthread.h
indra/llmessage/llcurl.cpp
+38
-25
38 additions, 25 deletions
indra/llmessage/llcurl.cpp
indra/llmessage/llcurl.h
+2
-0
2 additions, 0 deletions
indra/llmessage/llcurl.h
with
45 additions
and
27 deletions
indra/llcommon/llthread.h
+
5
−
2
View file @
c7f9c3af
...
...
@@ -187,11 +187,14 @@ class LLMutexLock
LLMutexLock
(
LLMutex
*
mutex
)
{
mMutex
=
mutex
;
mMutex
->
lock
();
if
(
mMutex
)
mMutex
->
lock
();
}
~
LLMutexLock
()
{
mMutex
->
unlock
();
if
(
mMutex
)
mMutex
->
unlock
();
}
private
:
LLMutex
*
mMutex
;
...
...
This diff is collapsed.
Click to expand it.
indra/llmessage/llcurl.cpp
+
38
−
25
View file @
c7f9c3af
...
...
@@ -219,11 +219,15 @@ namespace boost
std
::
set
<
CURL
*>
LLCurl
::
Easy
::
sFreeHandles
;
std
::
set
<
CURL
*>
LLCurl
::
Easy
::
sActiveHandles
;
LLMutex
*
LLCurl
::
Easy
::
sHandleMutexp
=
NULL
;
//static
CURL
*
LLCurl
::
Easy
::
allocEasyHandle
()
{
CURL
*
ret
=
NULL
;
LLMutexLock
lock
(
sHandleMutexp
)
;
if
(
sFreeHandles
.
empty
())
{
ret
=
curl_easy_init
();
...
...
@@ -251,6 +255,7 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle)
llerrs
<<
"handle cannot be NULL!"
<<
llendl
;
}
LLMutexLock
lock
(
sHandleMutexp
)
;
if
(
sActiveHandles
.
find
(
handle
)
!=
sActiveHandles
.
end
())
{
sActiveHandles
.
erase
(
handle
);
...
...
@@ -519,7 +524,8 @@ LLCurl::Multi::Multi()
mState
(
STATE_READY
),
mDead
(
FALSE
),
mMutexp
(
NULL
),
mDeletionMutexp
(
NULL
)
mDeletionMutexp
(
NULL
),
mEasyMutexp
(
NULL
)
{
mCurlMultiHandle
=
curl_multi_init
();
if
(
!
mCurlMultiHandle
)
...
...
@@ -534,6 +540,7 @@ LLCurl::Multi::Multi()
{
mMutexp
=
new
LLMutex
(
NULL
)
;
mDeletionMutexp
=
new
LLMutex
(
NULL
)
;
mEasyMutexp
=
new
LLMutex
(
NULL
)
;
}
LLCurl
::
getCurlThread
()
->
addMulti
(
this
)
;
...
...
@@ -563,6 +570,8 @@ LLCurl::Multi::~Multi()
mMutexp
=
NULL
;
delete
mDeletionMutexp
;
mDeletionMutexp
=
NULL
;
delete
mEasyMutexp
;
mEasyMutexp
=
NULL
;
--
gCurlMultiCount
;
}
...
...
@@ -585,17 +594,9 @@ void LLCurl::Multi::unlock()
void
LLCurl
::
Multi
::
markDead
()
{
if
(
mDeletionMutexp
)
{
mDeletionMutexp
->
lock
()
;
}
LLMutexLock
lock
(
mDeletionMutexp
)
;
mDead
=
TRUE
;
if
(
mDeletionMutexp
)
{
mDeletionMutexp
->
unlock
()
;
}
}
void
LLCurl
::
Multi
::
setState
(
LLCurl
::
Multi
::
ePerformState
state
)
...
...
@@ -655,10 +656,8 @@ CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue)
//return true if dead
bool
LLCurl
::
Multi
::
doPerform
()
{
if
(
mDeletionMutexp
)
{
mDeletionMutexp
->
lock
()
;
}
LLMutexLock
lock
(
mDeletionMutexp
)
;
bool
dead
=
mDead
;
if
(
mDead
)
...
...
@@ -675,6 +674,7 @@ bool LLCurl::Multi::doPerform()
call_count
<
MULTI_PERFORM_CALL_REPEAT
;
call_count
++
)
{
LLMutexLock
lock
(
mMutexp
)
;
CURLMcode
code
=
curl_multi_perform
(
mCurlMultiHandle
,
&
q
);
if
(
CURLM_CALL_MULTI_PERFORM
!=
code
||
q
==
0
)
{
...
...
@@ -688,11 +688,6 @@ bool LLCurl::Multi::doPerform()
setState
(
STATE_COMPLETED
)
;
}
if
(
mDeletionMutexp
)
{
mDeletionMutexp
->
unlock
()
;
}
return
dead
;
}
...
...
@@ -743,19 +738,21 @@ S32 LLCurl::Multi::process()
LLCurl
::
Easy
*
LLCurl
::
Multi
::
allocEasy
()
{
Easy
*
easy
=
0
;
Easy
*
easy
=
0
;
if
(
mEasyFreeList
.
empty
())
{
{
easy
=
Easy
::
getEasy
();
}
else
{
LLMutexLock
lock
(
mEasyMutexp
)
;
easy
=
*
(
mEasyFreeList
.
begin
());
mEasyFreeList
.
erase
(
easy
);
}
if
(
easy
)
{
LLMutexLock
lock
(
mEasyMutexp
)
;
mEasyActiveList
.
insert
(
easy
);
mEasyActiveMap
[
easy
->
getCurlHandle
()]
=
easy
;
}
...
...
@@ -764,6 +761,7 @@ LLCurl::Easy* LLCurl::Multi::allocEasy()
bool
LLCurl
::
Multi
::
addEasy
(
Easy
*
easy
)
{
LLMutexLock
lock
(
mMutexp
)
;
CURLMcode
mcode
=
curl_multi_add_handle
(
mCurlMultiHandle
,
easy
->
getCurlHandle
());
check_curl_multi_code
(
mcode
);
//if (mcode != CURLM_OK)
...
...
@@ -776,22 +774,30 @@ bool LLCurl::Multi::addEasy(Easy* easy)
void
LLCurl
::
Multi
::
easyFree
(
Easy
*
easy
)
{
mEasyMutexp
->
lock
()
;
mEasyActiveList
.
erase
(
easy
);
mEasyActiveMap
.
erase
(
easy
->
getCurlHandle
());
if
(
mEasyFreeList
.
size
()
<
EASY_HANDLE_POOL_SIZE
)
{
easy
->
resetState
();
{
mEasyFreeList
.
insert
(
easy
);
mEasyMutexp
->
unlock
()
;
easy
->
resetState
();
}
else
{
mEasyMutexp
->
unlock
()
;
delete
easy
;
}
}
void
LLCurl
::
Multi
::
removeEasy
(
Easy
*
easy
)
{
check_curl_multi_code
(
curl_multi_remove_handle
(
mCurlMultiHandle
,
easy
->
getCurlHandle
()));
{
LLMutexLock
lock
(
mMutexp
)
;
check_curl_multi_code
(
curl_multi_remove_handle
(
mCurlMultiHandle
,
easy
->
getCurlHandle
()));
}
easyFree
(
easy
);
}
...
...
@@ -1290,6 +1296,10 @@ void LLCurl::initClass(bool multi_threaded)
#endif
sCurlThread
=
new
LLCurlThread
(
multi_threaded
)
;
if
(
multi_threaded
)
{
Easy
::
sHandleMutexp
=
new
LLMutex
(
NULL
)
;
}
}
void
LLCurl
::
cleanupClass
()
...
...
@@ -1319,6 +1329,9 @@ void LLCurl::cleanupClass()
Easy
::
sFreeHandles
.
clear
();
delete
Easy
::
sHandleMutexp
;
Easy
::
sHandleMutexp
=
NULL
;
llassert
(
Easy
::
sActiveHandles
.
empty
());
}
...
...
This diff is collapsed.
Click to expand it.
indra/llmessage/llcurl.h
+
2
−
0
View file @
c7f9c3af
...
...
@@ -253,6 +253,7 @@ class LLCurl::Easy
static
std
::
set
<
CURL
*>
sFreeHandles
;
static
std
::
set
<
CURL
*>
sActiveHandles
;
static
LLMutex
*
sHandleMutexp
;
};
class
LLCurl
::
Multi
...
...
@@ -316,6 +317,7 @@ class LLCurl::Multi
BOOL
mDead
;
LLMutex
*
mMutexp
;
LLMutex
*
mDeletionMutexp
;
LLMutex
*
mEasyMutexp
;
};
class
LLCurlThread
:
public
LLQueuedThread
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment