Skip to content
Snippets Groups Projects
Commit ef717e8a authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

Bug 1589: Checking of some missing files.

parent 0aef873e
No related branches found
No related tags found
No related merge requests found
...@@ -897,6 +897,7 @@ MAC/APL/PAC/ITRFCalServer/src/LBACalibration.cc -text ...@@ -897,6 +897,7 @@ MAC/APL/PAC/ITRFCalServer/src/LBACalibration.cc -text
MAC/APL/PAC/ITRFCalServer/src/LBACalibration.h -text MAC/APL/PAC/ITRFCalServer/src/LBACalibration.h -text
MAC/APL/PAC/ITRFCalServer/src/RequestPool.cc -text MAC/APL/PAC/ITRFCalServer/src/RequestPool.cc -text
MAC/APL/PAC/ITRFCalServer/src/RequestPool.h -text MAC/APL/PAC/ITRFCalServer/src/RequestPool.h -text
MAC/APL/PAC/ITRFCalServer/src/SharedResource.h -text
MAC/APL/PAC/ITRFCalServer/src/SourceCatalog.conf.in -text MAC/APL/PAC/ITRFCalServer/src/SourceCatalog.conf.in -text
MAC/APL/PAC/ITRFCalServer/src/SubArrayMgr.cc -text MAC/APL/PAC/ITRFCalServer/src/SubArrayMgr.cc -text
MAC/APL/PAC/ITRFCalServer/src/SubArrayMgr.h -text MAC/APL/PAC/ITRFCalServer/src/SubArrayMgr.h -text
......
...@@ -32,7 +32,7 @@ target_link_libraries(iCalServer ...@@ -32,7 +32,7 @@ target_link_libraries(iCalServer
${CMAKE_CURRENT_BINARY_DIR}/../../LBA_Calibration/src/liblba_calibration.so ${CMAKE_CURRENT_BINARY_DIR}/../../LBA_Calibration/src/liblba_calibration.so
/usr/local/matlab-2008a/bin/glnx86/libmwmclmcrrt.so) /usr/local/matlab-2008a/bin/glnx86/libmwmclmcrrt.so)
foreach(file CalServer.conf SourceCatalog.conf) foreach(file iCalServer.conf SourceCatalog.conf)
configure_file( configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/${file}.in ${CMAKE_CURRENT_SOURCE_DIR}/${file}.in
${CMAKE_CURRENT_BINARY_DIR}/${file}) ${CMAKE_CURRENT_BINARY_DIR}/${file})
......
//# -*- mode: c++ -*-
//# SharedResource.h: Locking for shared resources. Not thread safe.
//#
//# Copyright (C) 2002-2004
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program is free software; you can redistribute it and/or modify
//# it under the terms of the GNU General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or
//# (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//#
//# You should have received a copy of the GNU General Public License
//# along with this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id: SharedResource.h 10637 2007-11-05 10:37:26Z overeem $
#ifndef SHAREDRESOURCE_H_
#define SHAREDRESOURCE_H_
#define CHECK_LOCKS
#ifdef CHECK_LOCKS
#undef PACKAGE
#undef VERSION
#include <lofar_config.h>
#include <Common/LofarLogger.h>
#endif
#include <pthread.h>
namespace LOFAR {
namespace ICAL {
class SharedResource
{
public:
explicit SharedResource(int maxreaders = 1, int maxwriters = 1) :
itsSemaphore(0),
itsMaxreaders(maxreaders),
itsMaxwriters(maxwriters)
{
(void)pthread_mutex_init(&itsMutex, 0);
}
virtual ~SharedResource() {}
inline int mutex_lock() { return pthread_mutex_lock(&itsMutex); }
inline int mutex_unlock() { return pthread_mutex_unlock(&itsMutex); }
/*@{*/
// Lock the resource for reading or writing.
// @return true if the locking succeeded, false otherwise.
inline bool writeLock() {
mutex_lock();
int success = itsSemaphore;
if (itsSemaphore <= 0 && itsSemaphore > -itsMaxwriters)
itsSemaphore--;
success -= itsSemaphore;
mutex_unlock();
return success;
}
inline bool readLock() {
mutex_lock();
int success = itsSemaphore;
if (itsSemaphore >= 0 && itsSemaphore < itsMaxreaders)
itsSemaphore++;
success -= itsSemaphore;
mutex_unlock();
return success;
}
/*@}*/
/*@{*/
// Unlock the resource.
inline void writeUnlock() {
mutex_lock();
itsSemaphore++;
if (itsSemaphore > 0) {
#ifdef CHECK_LOCKS
LOG_WARN("no matching writeLock for writeUnlock");
#endif
itsSemaphore = 0;
}
mutex_unlock();
}
inline void readUnlock() {
mutex_lock();
itsSemaphore--;
if (itsSemaphore < 0) {
#ifdef CHECK_LOCKS
LOG_WARN("no matching readLock for readUnlock");
#endif
itsSemaphore = 0;
}
mutex_unlock();
}
/*@}*/
/*@{*/
// Check whether the resource is locked for
// reading or writing, or for reading
// @return true if the resource is locked, false otherwise.
bool isLocked() {
bool success;
mutex_lock();
success = (0 != itsSemaphore);
mutex_unlock();
return success;
}
bool isWriteLocked() {
mutex_lock();
bool success;
success = (itsSemaphore < 0);
mutex_unlock();
return success;
}
bool isReadLocked() {
mutex_lock();
bool success;
success = (itsSemaphore > 0);
mutex_unlock();
return success;
}
private:
int itsSemaphore;
int itsMaxreaders;
int itsMaxwriters;
pthread_mutex_t itsMutex;
};
}; // namespace ICAL
}; // namespace LOFAR
#endif /* SHAREDRESOURCE_H_ */
...@@ -10,8 +10,9 @@ CalServer.firstSubband=1 ...@@ -10,8 +10,9 @@ CalServer.firstSubband=1
CalServer.lastSubband=511 CalServer.lastSubband=511
# #
# Set name for various configuration files # setup values for the Baseline Restriction
CalServer.SourceCatalogFile=SourceCatalog.conf CalServer.relativeBRinWaves = 4
CalServer.maxAbsBRinMeters = 10
# #
# For testing purposes, read ACC from file # For testing purposes, read ACC from file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment