Questions tagged [interlocked]

Provides atomic operations for variables that are shared by multiple threads.

Provides atomic operations for variables that are shared by multiple threads.

References

233 questions
0
votes
1 answer

Diffie-Hellman and the Rivest Shamir interlock protocol?

So Diffie-Hellman is subject to a MITM attack where two parties exchange: X = g^x mod n and Y = g^y mod n. Now presumably this can be protected against by using the Rivest Shamir interlock protocol where we split a message into two pieces and…
IApp
  • 667
  • 1
  • 6
  • 18
0
votes
2 answers

Is there an Interlocked for this? C++

Please note - these builds are for VS2008/VS2010 builds I cannot use any 11 constructs. Imagine I have subscribers listening to some publisher. My publisher has a container of subscriber pointers. In my void detach(ISubscriber *), instead of locking…
clanmjc
  • 299
  • 1
  • 9
0
votes
2 answers

Correct way of checking when ThreadPool threads are done?

I'm looking for a way of checking when all threads in threadpool have finished their tasks. Currently I'm using a counter that decrements when a thread has finished it's job and when counter == 0 I'm invoking my WorkComplete method. This seems to…
dtsg
  • 4,408
  • 4
  • 30
  • 40
0
votes
1 answer

.net System.MemberwiseClone and interlocked writes

When performing a MemberwiseClone of an array of value types: var arr = new double[100]; If these doubles are being modified using an Interlocked write on other threads, will the MemberwiseCloned copy be at any risk of having torn doubles in it?…
DanH
  • 3,772
  • 2
  • 27
  • 31
-1
votes
1 answer

Interlocked.Exchange influence on following instructions

If thread 1 runs: this.Field.Flag = false; ... var oldValue = Interlocked.Exchange(ref this.Field, newValue); oldValue.Flag = true; and thread 2 sees oldValue.Flag == true, is it guaranteed that it also sees this.Field == newValue even if it…
andresp
  • 1,624
  • 19
  • 31
-1
votes
1 answer

How to use Interlocked Method in overlapping multi-thread cumulative Stopwatch variable

I have a stopwatch embedded in my progress reporting under the hoods of async/await, task. run(), and parallel. for. The stopwatch captures the duration between the process and the cumulative duration as well. I checked my code with…
-1
votes
2 answers

Interlocked.exchange as a lock

I'm trying to use Interlocked.Exchange to create a thread safe lock for some object initialize functions. Consider the below code. I want to be sure that the if is doing the same as when the while is substituted. The reason I ask is if the code is…
DubMan
  • 430
  • 3
  • 16
-2
votes
2 answers

Function InterlockedExchange

I'm working with a list that is shared among many threads. I believe that to a good performance in this case, it will be good to use InterlockedExchange function to insert data in this list, but I have some doubts. If a thread tries to read a…
1 2 3
15
16