Silence invalid offsetof warning, only used in static_assert
[jack2.git] / windows / JackWinNamedPipeServerNotifyChannel.cpp
blob76af97c602f340cb135bfa08d133239a8a3fdc01
1 /*
2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 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 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "JackWinNamedPipeServerNotifyChannel.h"
21 #include "JackError.h"
22 #include "JackRequest.h"
23 #include "JackConstants.h"
24 #include "JackNotification.h"
26 namespace Jack
29 int JackWinNamedPipeServerNotifyChannel::Open(const char* server_name)
31 if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) {
32 jack_error("Cannot connect to server pipe");
33 return -1;
34 } else {
35 return 0;
39 void JackWinNamedPipeServerNotifyChannel::Close()
41 fRequestPipe.Close();
45 The requirement is that the Notification from RT thread can be delivered... not sure using a pipe is adequate here...
46 Can the write operation block?
47 A non blocking write operation should be used : check if write can succeed, and ignore the notification otherwise
48 (since its mainly used for XRun, ignoring a notification is OK, successive XRun will come...)
50 void JackWinNamedPipeServerNotifyChannel::Notify(int refnum, int notify, int value)
52 JackClientNotificationRequest req(refnum, notify, value);
53 if (req.Write(&fRequestPipe) < 0) {
54 jack_error("Could not write notification ref = %d notify = %d", refnum, notify);
58 void JackWinNamedPipeServerNotifyChannel::NotifyQuit()
60 Notify(-1, kQUIT, 0);
63 } // end of namespace