File: dintrthread.h

package info (click to toggle)
tango 9.2.5a%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 21,624 kB
  • ctags: 11,597
  • sloc: cpp: 135,480; sh: 21,772; makefile: 1,103; ansic: 1,083; java: 215; python: 55
file content (106 lines) | stat: -rw-r--r-- 3,069 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//==================================================================================================================
//
// file :               dintrthread.h
//
// description :        Include for the DevIntrThread object. This class implements the thread used to push device
//						interface change event
//
// project :            TANGO
//
// author(s) :          E.Taurel
//
// Copyright (C) :      2014
//						European Synchrotron Radiation Facility
//                      BP 220, Grenoble 38043
//                      FRANCE
//
// This file is part of Tango.
//
// Tango is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tango 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License along with Tango.
// If not, see <http://www.gnu.org/licenses/>.
//
// $Revision: 24813 $
//
//==================================================================================================================

#ifndef _DINTRTHREAD_H
#define _DINTRTHREAD_H

namespace Tango
{

class DevIntr;

//=================================================================================================================
//
//			The DevIntrThCmd structure
//
// description :
//		This structure is used to shared data between the Device interface change thread and the main thread.
//
//================================================================================================================

enum DevIntrCmdCode
{
	DEV_INTR_SLEEP = 0,
	DEV_INTR_EXIT
};

struct _ShDevIntrTh
{
	bool			cmd_pending;	// The new command flag
	DevIntrCmdCode	cmd_code;		// The command code
	bool			th_running;		// Thread running flag
	DevIntr			interface;		// Device interface
};
typedef struct _ShDevIntrTh	ShDevIntrTh;

enum DevIntrCmdType
{
	DEV_INTR_TIME_OUT = 0,
	DEV_INTR_COMMAND
};

//=================================================================================================================
//
//			The DevIntrThread class
//
// description :
//		Class to store all the necessary information for the device interface change event thread.
//		It's run() method is the thread code
//		This is a detached thread
//
//=================================================================================================================

class TangoMonitor;

class DevIntrThread: public omni_thread
{
public:
	DevIntrThread(ShDevIntrTh &,TangoMonitor &,DeviceImpl *);

	void run(void *);

	void execute_cmd();
	DevIntrCmdType get_command(DevLong);
	void push_event();

protected:
	ShDevIntrTh				&shared_data;
	TangoMonitor			&p_mon;
	DeviceImpl				*dev;

	ShDevIntrTh				local_cmd;
};

} // End of Tango namespace

#endif /* _DINTRTHREAD_ */