00001 #ifndef BULK_DATA_NT_THREAD_SYNC_GUARD_H 00002 #define BULK_DATA_NT_THREAD_SYNC_GUARD_H 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimeter Array 00005 * Copyright (c) AUI - Associated Universities Inc., 2013 00006 * (in the framework of the ALMA collaboration). 00007 * All rights reserved. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 ******************************************************************************* 00023 * 00024 * "@(#) $Id: bulkDataNTThreadSyncGuard.h,v 1.1 2013/02/11 18:37:33 rbourtem Exp $" 00025 * 00026 * who when what 00027 * -------- ---------- ---------------------------------------------- 00028 * rbourtem 2013-02-13 created from CorrThreadSyncGuard.h file 00029 */ 00030 00031 // 00032 // System stuff 00033 // 00034 00035 // 00036 // ACS stuff 00037 // 00038 #include <acstimeTimeUtil.h> 00039 00040 // 00041 // CORR stuff 00042 // 00043 #include <bulkDataNTGenEx.h> 00044 00045 namespace AcsBulkdata 00046 { 00049 class ThreadSyncGuard 00050 { 00051 public: 00055 ThreadSyncGuard(); 00056 00059 ThreadSyncGuard(const char *label, pthread_mutex_t *m); 00060 00063 ThreadSyncGuard(const char *label, pthread_mutex_t *m, const ACS::TimeInterval &to); 00064 00067 ~ThreadSyncGuard(); 00068 00071 void acquire(const ACS::TimeInterval &to); 00072 00073 private: 00078 ThreadSyncGuard(const ThreadSyncGuard &); 00079 ThreadSyncGuard & operator=(const ThreadSyncGuard &); 00080 00083 std::string m_label; 00084 00087 pthread_mutex_t *m_mutex_p; 00088 00091 bool m_acquired; 00092 }; 00093 }; 00094 00095 #endif 00096 00097 /*___oOo___*/