WPILib 2012
WPILibRoboticsLibraryforFRC
|
00001 /*----------------------------------------------------------------------------*/ 00002 /* Copyright (c) FIRST 2008. All Rights Reserved. */ 00003 /* Open Source Software - may be modified and shared by FRC teams. The code */ 00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ 00005 /*----------------------------------------------------------------------------*/ 00006 00007 #ifndef SYNCHRONIZED_H 00008 #define SYNCHRONIZED_H 00009 00010 #include "semLib.h" 00011 00012 #define CRITICAL_REGION(s) { Synchronized _sync(s); 00013 #define END_REGION } 00014 00025 class Synchronized 00026 { 00027 public: 00028 explicit Synchronized(SEM_ID); 00029 virtual ~Synchronized(); 00030 private: 00031 SEM_ID m_semaphore; 00032 }; 00033 00034 #endif