c# - Interlocked.Exchange and value types

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



// What I want to do

Use enumerated types with the Interlocked.Exchange methods
Suggestions please

// My estimation of problem

Seems like Interlocked.Exchange only works with ints, referencable objects,
and floats

// Background

I have a class that wraps up a worker thread to handle various requests
The thread function is implemeted as a looped switch based state machine
The state machine states are enumerated (via an enum)
Requests are made by the client through various methods exposed by the class
Requests are embodied using the enumeration described above
The requested enum state variable gets filed away via interlocked exchange
for later retrieval by worker thread..

// Confessions

works fine with C++ and CRTL. I'm a C# newbie

cheers


.



Relevant Pages

  • bizarre state machine behavior
    ... I had a fairly simple state machine written in VHDL, with an enumerated type and 5 states. ... So, I forced the enumeration to have specific binary-coded values, and ... I was careful to set up the if's for each specific state to have nested ifs in such a way so that any combination of input conditions could only satisfy one of the lowest nested ifs. ...
    (comp.arch.fpga)
  • Re: Slow FIFO using external SRAM
    ... > track of the read and write requests, updates the two addresses and ... The state machine must check for the two ... If read causes them to become equal, the FIFO ...
    (comp.arch.fpga)
  • Re: [RFC][PATCH] SPI subsystem
    ... This state machine provides useful framework ... for drivers that work with DMA and/or drivers that set their own wakeup ... doesn't accept any new requests but is able to successfully finish the ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Quartus II infered latches
    ... full state machine one hot wanted of and have it ... your state register to an type enumeration ... only reg_seli is used by quartus on state machine automatic. ...
    (comp.lang.vhdl)