Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cs/ds/alarm-handler
  • francesco.tripaldi/alarm-handler
2 results
Show changes
Showing
with 4141 additions and 42 deletions
/*
* update-thread.cpp
*
* $Author: claudio $
*
* $Revision: 1.2 $
*
* $Log: update-thread.cpp,v $
* Revision 1.2 2013-03-06 10:38:43 claudio
* commented out debug print statements
*
* Revision 1.1 2008-11-10 10:54:09 graziano
* thread for update of alarms with time threshold > 0
*
*
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY
*/
#include "update-thread.h"
......@@ -26,9 +8,9 @@ static const char __FILE__rev[] = __FILE__ " $Revision: 1.2 $";
/*
* alarm_thread::alarm_thread()
*/
update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p)
update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p),Tango::LogAdapter(p)
{
//cout << __FILE__rev << endl;
//TANGO_LOG << __FILE__rev << endl;
}
/*
......@@ -36,6 +18,7 @@ update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p)
*/
update_thread::~update_thread()
{
DEBUG_STREAM << __func__ << "update_thread::~update_thread(): entering!" << endl;
p_Alarm = NULL;
}
......@@ -44,6 +27,7 @@ update_thread::~update_thread()
*/
void update_thread::run(void *)
{
DEBUG_STREAM << __func__ << "update_thread::run(): entering!" << endl;
//printf("update_thread::run(): running...\n");
unsigned int pausasec, pausanano;
pausasec=1;
......@@ -52,14 +36,23 @@ void update_thread::run(void *)
while (!p_Alarm->abortflag) {
try
{
omni_thread::sleep(pausasec,pausanano);
p_Alarm->timer_update();
//omni_thread::sleep(pausasec,pausanano);
abort_sleep(pausasec+(double)pausanano/1000000000);
if(!p_Alarm->abortflag)
p_Alarm->timer_update();
//printf("update_thread::run(): TIMER!!\n");
}
catch(...)
{
printf("update_thread::run(): catched unknown exception!!\n");
INFO_STREAM << "update_thread::run(): catched unknown exception!!";
}
}
//cout << "update_thread::run(): exiting!" << endl;
DEBUG_STREAM << "update_thread::run(): exiting!" << endl;
} /* update_thread::run() */
void update_thread::abort_sleep(double time)
{
omni_mutex_lock sync(*this);
long time_millis = (long)(time*1000);
int res = wait(time_millis);
}
/*
* alarm-thread.h
*
* $Author: graziano $
*
* $Revision: 1.1 $
*
* $Log: update-thread.h,v $
* Revision 1.1 2008-11-10 10:54:09 graziano
* thread for update of alarms with time threshold > 0
*
*
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY
* update-thread.h
*/
#ifndef UPDATE_THREAD_H
#define UPDATE_THREAD_H
#include <omnithread.h>
#include <tango.h>
#include <tango/tango.h>
#include <AlarmHandler.h>
class update_thread : public omni_thread {
class update_thread : public omni_thread, public Tango::TangoMonitor, public Tango::LogAdapter {
public:
update_thread(AlarmHandler_ns::AlarmHandler *p);
~update_thread();
protected:
void run(void *);
private:
void abort_sleep(double time);
AlarmHandler_ns::AlarmHandler *p_Alarm;
};
......
cmake_minimum_required(VERSION 3.2)
project(test NONE)
include(ExternalProject)
ExternalProject_Add(testdevice
SOURCE_DIR ${CMAKE_SOURCE_DIR}/test/testdevice
# PREFIX ${CMAKE_BINARY_DIR}
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}"
# INSTALL_DIR ${CMAKE_BINARY_DIR}
# BINARY_DIR ${CMAKE_BINARY_DIR}
# STEP_TARGETS build
# EXCLUDE_FROM_ALL TRUE
)
ExternalProject_Get_property(testdevice SOURCE_DIR)
message("Source dir of testdevice = ${SOURCE_DIR}")
ExternalProject_Get_property(testdevice INSTALL_DIR)
message("Install dir of testdevice = ${INSTALL_DIR}")
ExternalProject_Get_property(testdevice BINARY_DIR)
message("Binary dir of testdevice = ${BINARY_DIR}")
ExternalProject_Get_property(testdevice CMAKE_ARGS)
message("CMqke args for testdevice = ${CMAKE_ARGS}")
#ExternalProject_Get_property(testdevice PREFIX)
#message("Prefix dir of testdevice = ${PREFIX}")
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
NAME_SRV = testdevice-srv
CXXFLAGS =
LDFLAGS =
include ./Make-9.3.4.in
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
cmake_minimum_required(VERSION 3.2)
# source files
set(SRC_FILES ${SRC_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/TestDevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TestDeviceClass.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TestDeviceStateMachine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ClassFactory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
PARENT_SCOPE)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.