Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
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
JennaHuntsman
XDG Integration
Commits
9adf357e
Commit
9adf357e
authored
1 year ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Bonk the threads
parent
dd157ebb
No related branches found
No related tags found
2 merge requests
!3
Update to main branch
,
!2
Rebase onto current main branch
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llcommon/llthread.cpp
+19
-17
19 additions, 17 deletions
indra/llcommon/llthread.cpp
indra/llcommon/llthread.h
+2
-3
2 additions, 3 deletions
indra/llcommon/llthread.h
with
21 additions
and
20 deletions
indra/llcommon/llthread.cpp
+
19
−
17
View file @
9adf357e
...
@@ -146,10 +146,8 @@ void LLThread::threadRun()
...
@@ -146,10 +146,8 @@ void LLThread::threadRun()
#endif
#endif
LL_PROFILER_SET_THREAD_NAME
(
mName
.
c_str
()
);
LL_PROFILER_SET_THREAD_NAME
(
mName
.
c_str
()
);
#ifndef LL_RELEASE_FOR_DOWNLOAD
// for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread
// for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread
mRecorder
=
new
LLTrace
::
ThreadRecorder
(
*
LLTrace
::
get_master_thread_recorder
());
mRecorder
=
std
::
make_unique
<
LLTrace
::
ThreadRecorder
>
(
*
LLTrace
::
get_master_thread_recorder
());
#endif
// Run the user supplied function
// Run the user supplied function
do
do
...
@@ -176,10 +174,7 @@ void LLThread::threadRun()
...
@@ -176,10 +174,7 @@ void LLThread::threadRun()
//LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL;
//LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL;
#ifndef LL_RELEASE_FOR_DOWNLOAD
mRecorder
.
reset
();
delete
mRecorder
;
mRecorder
=
NULL
;
#endif
// We're done with the run function, this thread is done executing now.
// We're done with the run function, this thread is done executing now.
//NB: we are using this flag to sync across threads...we really need memory barriers here
//NB: we are using this flag to sync across threads...we really need memory barriers here
...
@@ -192,9 +187,6 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
...
@@ -192,9 +187,6 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
mPaused
(
FALSE
),
mPaused
(
FALSE
),
mName
(
name
),
mName
(
name
),
mStatus
(
STOPPED
)
mStatus
(
STOPPED
)
#ifndef LL_RELEASE_FOR_DOWNLOAD
,
mRecorder
(
NULL
)
#endif
{
{
mRunCondition
=
std
::
make_unique
<
LLCondition
>
();
mRunCondition
=
std
::
make_unique
<
LLCondition
>
();
mDataLock
=
std
::
make_unique
<
LLMutex
>
();
mDataLock
=
std
::
make_unique
<
LLMutex
>
();
...
@@ -254,25 +246,33 @@ void LLThread::shutdown()
...
@@ -254,25 +246,33 @@ void LLThread::shutdown()
}
}
}
}
if
(
mThreadp
->
joinable
())
if
(
!
isStopped
())
{
{
mThreadp
->
join
();
// This thread just wouldn't stop, even though we gave it time
LL_INFOS
()
<<
"Successfully joined thread: "
<<
mName
<<
LL_ENDL
;
LL_WARNS
()
<<
"LLThread::~LLThread() exiting thread: "
<<
mName
<<
" before clean exit!"
<<
LL_ENDL
;
// Put a stake in its heart. (A very hostile method to force a thread to quit)
#if LL_WINDOWS
TerminateThread
(
mNativeHandle
,
0
);
#else
pthread_cancel
(
mNativeHandle
);
#endif
mRecorder
.
reset
();
mStatus
=
STOPPED
;
return
;
}
}
}
}
mThreadp
.
reset
();
mThreadp
.
reset
();
mRunCondition
.
reset
();
mRunCondition
.
reset
();
mDataLock
.
reset
();
mDataLock
.
reset
();
#ifndef LL_RELEASE_FOR_DOWNLOAD
if
(
mRecorder
)
if
(
mRecorder
)
{
{
// missed chance to properly shut down recorder (needs to be done in thread context)
// missed chance to properly shut down recorder (needs to be done in thread context)
// probably due to abnormal thread termination
// probably due to abnormal thread termination
// so just leak it and remove it from parent
// so just leak it and remove it from parent
LLTrace
::
get_master_thread_recorder
()
->
removeChildRecorder
(
mRecorder
);
LLTrace
::
get_master_thread_recorder
()
->
removeChildRecorder
(
mRecorder
.
get
()
);
}
}
#endif
}
}
void
LLThread
::
start
()
void
LLThread
::
start
()
...
@@ -281,6 +281,8 @@ void LLThread::start()
...
@@ -281,6 +281,8 @@ void LLThread::start()
try
try
{
{
mThreadp
=
std
::
make_unique
<
std
::
thread
>
(
std
::
bind
(
&
LLThread
::
threadRun
,
this
));
mThreadp
=
std
::
make_unique
<
std
::
thread
>
(
std
::
bind
(
&
LLThread
::
threadRun
,
this
));
mNativeHandle
=
mThreadp
->
native_handle
();
mThreadp
->
detach
();
}
}
catch
(
const
std
::
system_error
&
err
)
catch
(
const
std
::
system_error
&
err
)
{
{
...
@@ -302,7 +304,7 @@ LLThread::id_t LLThread::getID() const
...
@@ -302,7 +304,7 @@ LLThread::id_t LLThread::getID() const
bool
LLThread
::
setPriority
(
EThreadPriority
thread_priority
)
bool
LLThread
::
setPriority
(
EThreadPriority
thread_priority
)
{
{
if
(
!
mThreadp
)
return
false
;
if
(
!
mThreadp
)
return
false
;
#if
LL_WINDOWS
#if
0
int thread_prio = 0;
int thread_prio = 0;
switch (thread_priority)
switch (thread_priority)
{
{
...
...
This diff is collapsed.
Click to expand it.
indra/llcommon/llthread.h
+
2
−
3
View file @
9adf357e
...
@@ -108,9 +108,8 @@ class LL_COMMON_API LLThread
...
@@ -108,9 +108,8 @@ class LL_COMMON_API LLThread
std
::
unique_ptr
<
LLMutex
>
mDataLock
;
std
::
unique_ptr
<
LLMutex
>
mDataLock
;
std
::
unique_ptr
<
std
::
thread
>
mThreadp
;
std
::
unique_ptr
<
std
::
thread
>
mThreadp
;
std
::
atomic_int
mStatus
;
std
::
atomic_int
mStatus
;
#ifndef LL_RELEASE_FOR_DOWNLOAD
std
::
thread
::
native_handle_type
mNativeHandle
;
LLTrace
::
ThreadRecorder
*
mRecorder
;
std
::
unique_ptr
<
LLTrace
::
ThreadRecorder
>
mRecorder
;
#endif
//a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used.
//a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used.
//Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes.
//Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes.
...
...
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