public alias Message = int;
void threadFunc(){
import std.concurrency;
while(true){
auto m = receiveOnly!(Message);
}
}
void main(){
import core.thread;
import std.concurrency;
auto t = spawn(&threadFunc);
}
错误:ScopeDsymbol breeze.concurrency.task .__ anonymous .__ anonymous struct std.concurrency.Message是私有的
我无法使用receiveOnly
的别名。似乎D将它们设为私有我的默认值,但我明确将Message
标记为公开,但错误仍然存在。
答案 0 :(得分:4)
问题是别名Message
的名称与std.concurrency
中的私有结构冲突。这已在2.071.0版本中修复。因此,您可以将别名的名称升级或更改为其他名称。
更多信息:https://dlang.org/changelog/2.071.0.html#dip22和此处:http://www.schveiguy.com/blog/2016/03/import-changes-in-d-2-071/