Class Locker

Class Locker

Placement in the overall structure

Module
guard
Base classes
None
Derived classes
Guard
Time of creation
Task 3
Files
locker.h

Description

The Locker class implements a lock that can be used to protect critical sections. However, the variable only indicates whether the critical section is free. Potentially necessary waiting, and protection for counting functionality, must be implemented elsewhere.

Public methods

Locker ()
Constructor that initializes the lock variable (free).
void enter ()
This method must be called when entering the critical section.
void retne ()
This method must be called when leaving the critical section.
bool avail ()
Indicates whether the critical section is free.

Notes