Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
d3c21d6d
Commit
d3c21d6d
authored
Apr 23, 2014
by
David COME
Browse files
Moved a static counter shared among threads to the threadpool
parent
e6186f56
Changes
2
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/DiskReadThreadPool.cpp
View file @
d3c21d6d
...
...
@@ -33,7 +33,7 @@ namespace tapeserver {
namespace
daemon
{
DiskReadThreadPool
::
DiskReadThreadPool
(
int
nbThread
,
unsigned
int
maxFilesReq
,
unsigned
int
maxBytesReq
,
castor
::
log
::
LogContext
lc
)
:
m_lc
(
lc
),
m_maxFilesReq
(
maxFilesReq
),
m_maxBytesReq
(
maxBytesReq
){
castor
::
log
::
LogContext
lc
)
:
m_lc
(
lc
),
m_maxFilesReq
(
maxFilesReq
),
m_maxBytesReq
(
maxBytesReq
)
,
m_nbActiveThread
(
0
)
{
for
(
int
i
=
0
;
i
<
nbThread
;
i
++
)
{
DiskReadWorkerThread
*
thr
=
new
DiskReadWorkerThread
(
*
this
);
m_threads
.
push_back
(
thr
);
...
...
@@ -92,13 +92,12 @@ namespace daemon {
}
//end of while(1)
// We now acknowledge to the task injector that read reached the end. There
// will hence be no more requests for more. (last thread turns off the light)
if
(
0
==
--
m_nbActiveThread
)
{
if
(
0
==
--
m_
parent
.
m_
nbActiveThread
)
{
m_parent
.
m_injector
->
finish
();
m_lc
.
log
(
LOG_DEBUG
,
"Signaled to task injector the end of disk read threads"
);
}
m_lc
.
log
(
LOG_DEBUG
,
"Finishing of DiskReadWorkerThread"
);
}
tape
::
threading
::
AtomicCounter
<
int
>
DiskReadThreadPool
::
DiskReadWorkerThread
::
m_nbActiveThread
(
0
);
}}}}
castor/tape/tapeserver/daemon/DiskReadThreadPool.hpp
View file @
d3c21d6d
...
...
@@ -71,14 +71,13 @@ private:
class
DiskReadWorkerThread
:
private
castor
::
tape
::
threading
::
Thread
{
public:
DiskReadWorkerThread
(
DiskReadThreadPool
&
manager
)
:
m_threadID
(
m_nbActiveThread
++
),
m_parent
(
manager
),
m_lc
(
m_parent
.
m_lc
)
{
m_threadID
(
m_
parent
.
m_
nbActiveThread
++
),
m_parent
(
manager
),
m_lc
(
m_parent
.
m_lc
)
{
log
::
LogContext
::
ScopedParam
param
(
m_lc
,
log
::
Param
(
"threadID"
,
m_threadID
));
m_lc
.
log
(
LOG_INFO
,
"DiskWrite Thread created"
);
}
void
startThreads
()
{
start
();
}
void
waitThreads
()
{
wait
();
}
private:
static
tape
::
threading
::
AtomicCounter
<
int
>
m_nbActiveThread
;
const
int
m_threadID
;
DiskReadThreadPool
&
m_parent
;
castor
::
log
::
LogContext
m_lc
;
...
...
@@ -90,6 +89,8 @@ private:
MigrationTaskInjector
*
m_injector
;
const
unsigned
int
m_maxFilesReq
;
const
unsigned
int
m_maxBytesReq
;
tape
::
threading
::
AtomicCounter
<
int
>
m_nbActiveThread
;
};
}}}}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment