This is the very interesting agenda.
I know a method, but don't know that the method is recommended:
import std.bitmanip;
shared BitArray foo;
void main(){
(*cast(BitArray*)&foo) ~= true;
}
In addition, your code is filled up many 'cast' if you try to solve it
by this method.
This is clearly unfavorable.
See also: http://www.informit.com/articles/article.aspx?p=1609144
This article says that the basic policy about the multi-thread uses
message passing. When you use message passing, these problems rarely occur.
However, it is important that it is easily feasible even if it is other
methods.
I want to know a policy about this agenda.
--
SHOO
(2011/03/15 23:22), d coder wrote:
Greetings
I am trying to create a multithreaded application. Right now I am
finding it difficult to work with "shared" qualifier. One of the reasons
is that Phobos library does not seem compatible with "shared"
data-structures. For example:
import std.bitmanip;
shared BitArray foo;
void main() {
foo ~= true;// this does not work
(cast(BitArray)foo) ~= true;// Even casting does not help
}
I know that "shared" is a relatively new qualifier in D2. Are there
plans to make Phobos "shared" compatible?
Are there any workarounds that I am missing.
Regards
- Puneet