Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

What options do I have for pending work that can't acquire a lock via the following sample?

System.Threading.Interlocked.CompareExchange<TrustPointStatusEnum>
(ref tp.TrustPointStatus, TrustPointStatusEnum.NotInitalized,TrustPointStatusEnum.Loading);

Based on my research think I have the following options:

  • I can use Threading.SpinWait (for very quick IO tasks) at the cost of CPU
  • I can use Sleep() which has an unreliable wake up time

I'm not sure of any other option, but what I want to make sure of is that all these options work with the .NET 4 async and await keywords, especially if I use Task to run them on a background thread

share|improve this question
Don't you mean .NET Framework 4.5? – Bernard Oct 24 '12 at 2:58

closed as off topic by dasblinkenlight, Karl Bielefeldt, Bernard, ElYusubov, World Engineer Oct 24 '12 at 3:46

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.