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
95d73d42
Commit
95d73d42
authored
Apr 02, 2014
by
David COME
Browse files
Moved from nested endOfSession+endOfWork()==true sentinel to NULL
parent
c5165263
Changes
3
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/DiskReadThreadPool.hpp
View file @
95d73d42
...
...
@@ -37,7 +37,7 @@ namespace daemon {
class
DiskReadThreadPool
:
public
DiskThreadPoolInterface
<
DiskReadTaskInterface
>
{
public:
DiskReadThreadPool
(
int
nbThread
)
{
DiskReadThreadPool
(
int
nbThread
){
for
(
int
i
=
0
;
i
<
nbThread
;
i
++
)
{
DiskReadWorkerThread
*
thr
=
new
DiskReadWorkerThread
(
*
this
);
m_threads
.
push_back
(
thr
);
...
...
@@ -65,7 +65,7 @@ public:
void
finish
()
{
/* Insert one endOfSession per thread */
for
(
size_t
i
=
0
;
i
<
m_threads
.
size
();
i
++
)
{
m_tasks
.
push
(
new
endOfSession
);
m_tasks
.
push
(
NULL
);
}
}
...
...
@@ -78,11 +78,10 @@ private:
private:
DiskReadThreadPool
&
m_manager
;
virtual
void
run
()
{
std
::
auto_ptr
<
DiskReadTaskInterface
>
task
;
while
(
1
)
{
std
::
auto_ptr
<
DiskReadTaskInterface
>
task
(
m_manager
.
m_tasks
.
pop
());
bool
end
=
task
->
endOfWork
();
if
(
!
end
)
task
.
reset
(
m_manager
.
m_tasks
.
pop
());
if
(
NULL
!=
task
.
get
())
task
->
execute
();
else
break
;
...
...
castor/tape/tapeserver/daemon/DiskWriteThreadPool.hpp
View file @
95d73d42
...
...
@@ -78,7 +78,7 @@ public:
void
finish
()
{
/* Insert one endOfSession per thread */
for
(
size_t
i
=
0
;
i
<
m_threads
.
size
();
i
++
)
{
m_tasks
.
push
(
new
endOfSession
);
m_tasks
.
push
(
NULL
);
}
}
void
setJobInjector
(
TaskInjector
*
ji
){
...
...
@@ -128,10 +128,10 @@ private:
private:
DiskWriteThreadPool
&
m_manager
;
virtual
void
run
()
{
std
::
auto_ptr
<
DiskWriteTaskInterface
>
task
;
while
(
1
)
{
std
::
auto_ptr
<
DiskWriteTaskInterface
>
task
(
m_manager
.
popAndRequestMoreJobs
());
bool
end
=
task
->
endOfWork
();
if
(
!
end
)
task
.
reset
(
m_manager
.
popAndRequestMoreJobs
());
if
(
NULL
!=
task
.
get
())
task
->
execute
();
else
{
printf
(
"Disk write thread finishing
\n
"
);
...
...
castor/tape/tapeserver/daemon/RecallTaskInjectorTest.cpp
View file @
95d73d42
...
...
@@ -19,7 +19,7 @@ public:
virtual
void
finish
()
{
m_tasks
.
push
(
new
endOfSession
);
m_tasks
.
push
(
NULL
);
}
virtual
void
push
(
DiskWriteTaskInterface
*
t
){
m_tasks
.
push
(
t
);
...
...
@@ -92,9 +92,8 @@ TEST(castor_tape_tapeserver_daemon, RecallTaskInjectorNominal) {
DiskWriteTaskInterface
*
diskWriteTask
=
diskWrite
.
m_tasks
.
pop
();
TapeReadTask
*
tapeReadTask
=
tapeRead
.
m_tasks
.
pop
();
ASSERT_EQ
(
diskWriteTask
->
endOfWork
(),
true
);
ASSERT_EQ
(
tapeReadTask
->
endOfWork
(),
true
);
ASSERT_EQ
(
NULL
,
diskWriteTask
);
ASSERT_EQ
(
true
,
tapeReadTask
->
endOfWork
());
delete
diskWriteTask
;
delete
tapeReadTask
;
}
...
...
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