digitalmars.D - Use tango.core.Atomic.atomicLoad and atomicStore from Tango
- Lukasz Durniat (6/6) Mar 25 2012 Hi,
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (4/10) Mar 25 2012 You know, we kinda need some code and compiler errors to help you out he...
- Lukasz Durniat (38/38) Mar 25 2012 Here is code:
- Lukasz Durniat (1/1) Mar 26 2012 Can somebody tell me what is wrong in my code?
- Lukasz Durniat (1/1) Mar 26 2012 Problem has been solved by me.
- mta`chrono (2/3) Mar 29 2012 Can you please tell me how you'd solved it?
Hi, When I use this function in program I have error during compiling proccess, so someone can show me how use(example) it in proper manner - without errors. I try find some samples or documentations but this dont help. Thanks for any help.
Mar 25 2012
On 25-03-2012 14:49, Lukasz Durniat wrote:Hi, When I use this function in program I have error during compiling proccess, so someone can show me how use(example) it in proper manner - without errors. I try find some samples or documentations but this dont help. Thanks for any help.You know, we kinda need some code and compiler errors to help you out here. -- - Alex
Mar 25 2012
Here is code: import Integer = tango.text.convert.Integer; import tango.math.random.Random; import tango.core.Thread; import tango.core.Atomic; class MyThread :Thread { bool* log; this( bool* log ) { super(&run); this.log = log; } void run() { auto rand = new Random(); if( rand.uniformR(2) == 0 ) { //atomicStore!(msync.raw, bool)(*log, false); //alias atomicStore!(msync.raw, bool) A; //A.atomicStore(*log); atomicStore!(msync.acq, bool).atomicStore(log); } } } void main(char[][] args) { int n = Integer.parse(args[1]); bool log = true; for(int i = 0; i < n; i++) (new MyThread( &log )).start(); } Here are errors when I compiling program: Error: function tango.core.Atomic.atomicStore!(cast(msync)5,b ool,bool) does not match parameter types () Error: expected 2 function arguments, not 0 Error: no property 'atomicStore' for type 'void' Error: function expected before (), not 1 of type int I dont know what is wrong.
Mar 25 2012
Can somebody tell me what is wrong in my code?
Mar 26 2012
Am 26.03.2012 19:26, schrieb Lukasz Durniat:Problem has been solved by me.Can you please tell me how you'd solved it?
Mar 29 2012