Cleanup thread code.
[jack2.git] / common / JackClientControl.h
bloba82313c763ed852afddcf6ae32617c27ae37043f
1 /*
2 Copyright (C) 2003 Paul Davis
3 Copyright (C) 2004-2008 Grame
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef __JackClientControl__
22 #define __JackClientControl__
24 #include "JackShmMem.h"
25 #include "JackPort.h"
26 #include "JackSynchro.h"
27 #include "JackNotification.h"
29 namespace Jack
32 /*!
33 \brief Client control possibly in shared memory.
36 struct JackClientControl : public JackShmMemAble
38 char fName[JACK_CLIENT_NAME_SIZE + 1];
39 bool fCallback[kMaxNotification];
40 volatile jack_transport_state_t fTransportState;
41 volatile bool fTransportSync; /* Will be true when slow-sync cb has to be called */
42 volatile bool fTransportTimebase; /* Will be true when timebase cb is called with new_pos on */
43 int fRefNum;
44 int fPID;
45 bool fActive;
47 JackClientControl(const char* name, int pid, int refnum)
49 Init(name, pid, refnum);
52 JackClientControl(const char* name)
54 Init(name, 0, -1);
57 JackClientControl()
59 Init("", 0, -1);
62 void Init(const char* name, int pid, int refnum)
64 strcpy(fName, name);
65 for (int i = 0; i < kMaxNotification; i++)
66 fCallback[i] = false;
67 // Always activated
68 fCallback[kAddClient] = true;
69 fCallback[kRemoveClient] = true;
70 fCallback[kActivateClient] = true;
71 // So that driver synchro are correctly setup in "flush" or "normal" mode
72 fCallback[kStartFreewheelCallback] = true;
73 fCallback[kStopFreewheelCallback] = true;
74 fRefNum = refnum;
75 fPID = pid;
76 fTransportState = JackTransportStopped;
77 fTransportSync = false;
78 fTransportTimebase = false;
79 fActive = false;
82 } POST_PACKED_STRUCTURE;
84 } // end of namespace
87 #endif