C# Class Shielded.VersionList

This class handles everything about assigning version stamps to readers and writers, and takes care of determining what is the minimum used stamp, so that old unreachable versions can be released to the GC.
显示文件 Open project: jbakic/Shielded Class Usage Examples

Public Methods

Method Description
GetReaderTicket ( ReadTicket &ticket ) : void

Reader should keep a reference to his ticket, and release it with a call to ReleaseReaderTicket when done.

GetUntrackedReadStamp ( ) : ReadTicket

For commute running block, because it knows that the ticket taken by the main transaction is all the protection it needs.

NewVersion ( WriteStamp stamp, WriteTicket &ticket ) : void

Called after a thread checked and can commit. This will assign it a unique stamp to use for writing. This method will enter the new stamp into the stamp.Version. It must be done here to guarantee that no GetReaderTicket will return your stamp number before it has been written into your stamp lock! After completing your write, place your changes into the ticket, and this class will trim the old versions at the correct time. It is critical that this be done, which is why this method returns it as an out param - to make sure no exception can cause us to lose the ref to the ticket, if it is already in the chain.

ReleaseReaderTicket ( ReadTicket &ticket ) : void

After no reading will be done for the given reader ticket, release it with this method.

TrimCopies ( ) : void

Private Methods

Method Description
VersionList ( ) : System

Method Details

GetReaderTicket() public static method

Reader should keep a reference to his ticket, and release it with a call to ReleaseReaderTicket when done.
public static GetReaderTicket ( ReadTicket &ticket ) : void
ticket ReadTicket
return void

GetUntrackedReadStamp() public static method

For commute running block, because it knows that the ticket taken by the main transaction is all the protection it needs.
public static GetUntrackedReadStamp ( ) : ReadTicket
return ReadTicket

NewVersion() public static method

Called after a thread checked and can commit. This will assign it a unique stamp to use for writing. This method will enter the new stamp into the stamp.Version. It must be done here to guarantee that no GetReaderTicket will return your stamp number before it has been written into your stamp lock! After completing your write, place your changes into the ticket, and this class will trim the old versions at the correct time. It is critical that this be done, which is why this method returns it as an out param - to make sure no exception can cause us to lose the ref to the ticket, if it is already in the chain.
public static NewVersion ( WriteStamp stamp, WriteTicket &ticket ) : void
stamp WriteStamp
ticket WriteTicket
return void

ReleaseReaderTicket() public static method

After no reading will be done for the given reader ticket, release it with this method.
public static ReleaseReaderTicket ( ReadTicket &ticket ) : void
ticket ReadTicket
return void

TrimCopies() public static method

public static TrimCopies ( ) : void
return void