Hi Daniel,
On 08/18/16 18:29, Daniel Lehman wrote:
- pass = 0;
- pRtlCaptureContext(&ctx);
- if (InterlockedIncrement(&pass) == 1) /* interlocked to prevent compiler from moving */
The patch looks good for me except one thing that I don't understand. Why there's no risk that compiler will move the pass=0 assignment after pRtlCaptureContext call? Maybe something like this will be more correct: pass = 0; InterlockedIncrement(&pass); pRtlCaptureContext(&ctx); if (InterlockedIncrement(&pass) == 2) ?
Thanks, Piotr
On 08/18/16 18:29, Daniel Lehman wrote:
- pass = 0;
- pRtlCaptureContext(&ctx);
- if (InterlockedIncrement(&pass) == 1) /* interlocked to prevent
- compiler from moving */
The patch looks good for me except one thing that I don't understand. Why there's no risk that compiler will move the pass=0 assignment after pRtlCaptureContext call?
I can see how another compiler could move it; just didn't in my case. I'll send an updated version