MOOS 0.2375
|
00001 00002 // 00003 // MOOS - Mission Oriented Operating Suite 00004 // 00005 // A suit of Applications and Libraries for Mobile Robotics Research 00006 // Copyright (C) 2001-2005 Massachusetts Institute of Technology and 00007 // Oxford University. 00008 // 00009 // This software was written by Paul Newman at MIT 2001-2002 and Oxford 00010 // University 2003-2005. email: pnewman@robots.ox.ac.uk. 00011 // 00012 // This file is part of a MOOS Core Component. 00013 // 00014 // This program is free software; you can redistribute it and/or 00015 // modify it under the terms of the GNU General Public License as 00016 // published by the Free Software Foundation; either version 2 of the 00017 // License, or (at your option) any later version. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 // General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00027 // 02111-1307, USA. 00028 // 00030 /*************************************************************************** 00031 MOOSLock.h - description 00032 ------------------- 00033 begin : Mon Dec 18 2000 00034 copyright : (C) 2000 by pnewman 00035 email : pnewman@mit.edu 00036 ***************************************************************************/ 00037 00038 00039 // MOOSLock.h: interface for the CMOOSLock class. 00040 // 00042 00043 #if !defined(AFX_MOOSLock_H__85AEC656_8C4D_4D1B_BCF2_9814B2611F9E__INCLUDED_) 00044 #define AFX_MOOSLock_H__85AEC656_8C4D_4D1B_BCF2_9814B2611F9E__INCLUDED_ 00045 00046 #if _MSC_VER > 1000 00047 #pragma once 00048 #endif // _MSC_VER > 1000 00049 00050 //some conditional stuff.. 00051 #ifdef _WIN32 00052 #include "windows.h" 00053 #include "winbase.h" 00054 #include "winnt.h" 00055 #else 00056 #include <pthread.h> 00057 #endif 00058 00060 class CMOOSLock 00061 { 00062 public: 00064 void UnLock(); 00065 00067 void Lock(); 00068 00069 //default constructor has object unlocked intially 00070 CMOOSLock(bool bInitial = true); 00071 virtual ~CMOOSLock(); 00072 00073 protected: 00074 #ifdef _WIN32 00075 00076 HANDLE m_hLock; 00077 #else 00078 00079 pthread_mutex_t m_hLock; 00080 #endif 00081 00082 00083 00084 00085 }; 00086 00087 #endif // !defined(AFX_MOOSLock_H__85AEC656_8C4D_4D1B_BCF2_9814B2611F9E__INCLUDED_)