Thread overview
Use tango.core.Atomic.atomicLoad and atomicStore from Tango
Mar 25, 2012
Lukasz Durniat
Mar 25, 2012
Lukasz Durniat
Mar 26, 2012
Lukasz Durniat
Mar 26, 2012
Lukasz Durniat
Mar 29, 2012
mta`chrono
March 25, 2012
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.
March 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
March 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.

March 26, 2012
Can somebody tell me what is wrong in my code?
March 26, 2012
Problem has been  solved by me.

March 29, 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?