Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
ffcc7604
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ffcc7604
编写于
3月 31, 2018
作者:
A
Abhinav Arora
提交者:
Yi Wang
3月 31, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix deadlock in channel_test (#9544)
上级
0ee4565b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
5 addition
and
14 deletion
+5
-14
paddle/fluid/framework/CMakeLists.txt
paddle/fluid/framework/CMakeLists.txt
+1
-1
paddle/fluid/framework/channel_impl.h
paddle/fluid/framework/channel_impl.h
+4
-13
未找到文件。
paddle/fluid/framework/CMakeLists.txt
浏览文件 @
ffcc7604
...
...
@@ -104,7 +104,7 @@ cc_test(init_test SRCS init_test.cc DEPS init)
cc_test
(
op_kernel_type_test SRCS op_kernel_type_test.cc DEPS place device_context framework_proto
)
cc_test
(
cow_ptr_tests SRCS details/cow_ptr_test.cc
)
#
cc_test(channel_test SRCS channel_test.cc)
cc_test
(
channel_test SRCS channel_test.cc
)
cc_test
(
tuple_test SRCS tuple_test.cc
)
cc_test
(
concurrency_test SRCS concurrency_test.cc DEPS go_op channel_close_op channel_create_op
channel_send_op channel_recv_op sum_op select_op elementwise_add_op compare_op
...
...
paddle/fluid/framework/channel_impl.h
浏览文件 @
ffcc7604
...
...
@@ -138,8 +138,8 @@ void ChannelImpl<T>::Send(T *item) {
// If channel is closed, throw exception
if
(
closed_
)
{
lock
.
unlock
();
send_return
();
lock
.
unlock
();
PADDLE_THROW
(
"Cannot send on closed channel"
);
}
...
...
@@ -152,11 +152,9 @@ void ChannelImpl<T>::Send(T *item) {
if
(
m
!=
nullptr
)
{
*
(
m
->
data
)
=
std
::
move
(
*
item
);
m
->
Notify
();
lock
.
unlock
();
send_return
();
return
;
}
else
{
lock
.
unlock
();
Send
(
item
);
send_return
();
return
;
...
...
@@ -169,8 +167,6 @@ void ChannelImpl<T>::Send(T *item) {
if
(
buf_
.
size
()
<
cap_
)
{
// Copy to buffer
buf_
.
push_back
(
std
::
move
(
*
item
));
// Release lock and return true
lock
.
unlock
();
send_return
();
return
;
}
...
...
@@ -181,8 +177,8 @@ void ChannelImpl<T>::Send(T *item) {
sendq
.
push_back
(
m
);
m
->
Wait
(
lock
);
if
(
m
->
chan_closed
)
{
lock
.
unlock
();
send_return
();
lock
.
unlock
();
PADDLE_THROW
(
"Cannot send on closed channel"
);
}
send_return
();
...
...
@@ -195,10 +191,7 @@ bool ChannelImpl<T>::Receive(T *item) {
// If channel is closed and buffer is empty or
// channel is unbuffered
if
(
closed_
&&
buf_
.
empty
())
{
lock
.
unlock
();
return
recv_return
(
false
);
}
if
(
closed_
&&
buf_
.
empty
())
return
recv_return
(
false
);
// If there is a sender, directly receive the value we want
// from the sender. In case of a buffered channel, read from
...
...
@@ -229,7 +222,6 @@ bool ChannelImpl<T>::Receive(T *item) {
}
else
return
recv_return
(
Receive
(
item
));
}
lock
.
unlock
();
return
recv_return
(
true
);
}
...
...
@@ -238,8 +230,7 @@ bool ChannelImpl<T>::Receive(T *item) {
// Directly read from buffer
*
item
=
std
::
move
(
buf_
.
front
());
buf_
.
pop_front
();
// Release lock and return true
lock
.
unlock
();
// return true
return
recv_return
(
true
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录