/* * * Name Lawrence Bush * Student Number 660 220 742 * Email bushl2@rpi.edu, Lawrence_Bush@dps.state.ny.us * Class Distributed Algorithms and Systems (Spring 2002) * Professor Costas Busch * * Final Project Implement a Lock-Free Linked List (based on Valois' paper) * */ // ////////////////////////////////////////////////////////////////////// // Description of Program Files // // File Purpose // ---- ------- // criticalsection.cpp This file implements the critical section class. // This class makes it easier to instantiate, enter, and // leave a windows critical section. // // When a CriticalSection object is created, it automatically // creates a real windows critical section. // // Basically, it makes the calls object oriented rather than // oriented. It also makes them look nicer. // // The real benefit is when this object is used with the lock object. // // // ************************************* // ************************************* // *** *** // *** Critical Section *** // *** Implementation *** // *** *** // ************************************* // ************************************* // #include "CriticalSection.h" // ***** Constructor ***** // This constructor initializes the windows CRITICAL_SECTION // object that is a member of this class. CriticalSection::CriticalSection() { InitializeCriticalSection(&m_CritSect); } // ***** Destructor ***** // This destructor deletes the windows CRITICAL_SECTION // object that is a member of this class. CriticalSection::~CriticalSection() { DeleteCriticalSection(&m_CritSect); } // ***** Enter ***** // This function calls the real enter critical section // on the windows CRITICAL_SECTION // object that is a member of this class. void CriticalSection:: Enter() { EnterCriticalSection(&m_CritSect); } // ***** Enter ***** // This function calls the real leave critical section // on the windows CRITICAL_SECTION // object that is a member of this class. void CriticalSection::Leave() { LeaveCriticalSection(&m_CritSect); }