www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Interlocked (compare) exchange

reply "Szymon Gatner" <noemail gmail.com> writes:
Hi,

are there equivalents of Interlocked.Exchange [1] and 
Interlocked.CompareExchange [2] in D? I can't find it in teh docs?

[1] 
https://msdn.microsoft.com/en-us/library/f2090ex9(v=vs.110).aspx

[2] 
https://msdn.microsoft.com/en-us/library/h7etff8w(v=vs.110).aspx
Apr 17 2015
next sibling parent "Tobias Pankrath" <tobias pankrath.net> writes:
On Friday, 17 April 2015 at 10:36:33 UTC, Szymon Gatner wrote:
 Hi,

 are there equivalents of Interlocked.Exchange [1] and 
 Interlocked.CompareExchange [2] in D? I can't find it in teh 
 docs?

 [1] 
 https://msdn.microsoft.com/en-us/library/f2090ex9(v=vs.110).aspx

 [2] 
 https://msdn.microsoft.com/en-us/library/h7etff8w(v=vs.110).aspx
[2] sounds like compare-and-swap from http://dlang.org/phobos/core_atomic.html
Apr 17 2015
prev sibling next sibling parent Max Klyga <max.klyga gmail.com> writes:
On 2015-04-17 10:36:31 +0000, Szymon Gatner said:

 Hi,
 
 are there equivalents of Interlocked.Exchange [1] and 
 Interlocked.CompareExchange [2] in D? I can't find it in teh docs?
 
 [1] https://msdn.microsoft.com/en-us/library/f2090ex9(v=vs.110).aspx
 
 [2] https://msdn.microsoft.com/en-us/library/h7etff8w(v=vs.110).aspx
http://dlang.org/phobos/core_atomic.html#.cas
Apr 17 2015
prev sibling parent reply "rumbu" <rumbu rumbu.ro> writes:
On Friday, 17 April 2015 at 10:36:33 UTC, Szymon Gatner wrote:
 Hi,

 are there equivalents of Interlocked.Exchange [1] and 
 Interlocked.CompareExchange [2] in D? I can't find it in teh 
 docs?

 [1] 
 https://msdn.microsoft.com/en-us/library/f2090ex9(v=vs.110).aspx

 [2] 
 https://msdn.microsoft.com/en-us/library/h7etff8w(v=vs.110).aspx
All D equivalents of Interlocked class methods: https://github.com/rumbu13/sharp/blob/master/src/system/threading/package.d
Apr 17 2015
parent "Szymon Gatner" <noemail gmail.com> writes:
On Friday, 17 April 2015 at 11:00:40 UTC, rumbu wrote:
 On Friday, 17 April 2015 at 10:36:33 UTC, Szymon Gatner wrote:
 Hi,

 are there equivalents of Interlocked.Exchange [1] and 
 Interlocked.CompareExchange [2] in D? I can't find it in teh 
 docs?

 [1] 
 https://msdn.microsoft.com/en-us/library/f2090ex9(v=vs.110).aspx

 [2] 
 https://msdn.microsoft.com/en-us/library/h7etff8w(v=vs.110).aspx
All D equivalents of Interlocked class methods: https://github.com/rumbu13/sharp/blob/master/src/system/threading/package.d
Ah, thanks to all you guys!
Apr 17 2015