Fixes for alsa device reservation
[jack2.git] / windows / JackWinNamedPipeServerChannel.h
blobc798ed0b349a2c96844c65460c4589bdc2b0f8a2
1 /*
2 Copyright (C) 2004-2008 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef __JackWinNamedPipeServerChannel__
22 #define __JackWinNamedPipeServerChannel__
24 #include "JackWinNamedPipe.h"
25 #include "JackPlatformPlug.h"
26 #include "JackConstants.h"
27 #include <list>
29 namespace Jack
32 class JackServer;
34 class JackClientPipeThread : public JackRunnableInterface
37 private:
39 JackWinNamedPipeClient* fPipe;
40 JackServer* fServer;
41 JackThread fThread;
42 int fRefNum;
44 void ClientAdd(char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
45 void ClientRemove();
46 void ClientKill();
48 static HANDLE fMutex;
50 public:
52 JackClientPipeThread(JackWinNamedPipeClient* pipe);
53 virtual ~JackClientPipeThread();
55 int Open(JackServer* server); // Open the Server/Client connection
56 void Close(); // Close the Server/Client connection
58 bool HandleRequest();
60 // JackRunnableInterface interface
61 bool Execute();
63 // To be used for find out if the object can be deleted
64 bool IsRunning()
66 return (fRefNum >= 0);
70 /*!
71 \brief JackServerChannel using pipe.
74 class JackWinNamedPipeServerChannel : public JackRunnableInterface
77 private:
79 JackWinNamedPipeServer fRequestListenPipe; // Pipe to create request socket for the client
80 JackServer* fServer;
81 JackThread fThread; // Thread to execute the event loop
82 char fServerName[JACK_SERVER_CONTROL_NAME_SIZE];
84 std::list<JackClientPipeThread*> fClientList;
86 void ClientAdd(JackWinNamedPipeClient* pipe);
88 public:
90 JackWinNamedPipeServerChannel();
91 ~JackWinNamedPipeServerChannel();
93 int Open(const char* server_name, JackServer* server); // Open the Server/Client connection
94 void Close(); // Close the Server/Client connection
96 int Start();
97 void Stop();
99 // JackRunnableInterface interface
100 bool Init();
101 bool Execute();
105 } // end of namespace
107 #endif