Merge branch 'netone-isolateion'
[jack2.git] / windows / JackWinNamedPipeServerNotifyChannel.cpp
blob7f2f14cf299635879e31507697ad5186ad414717
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"
25 namespace Jack
28 int JackWinNamedPipeServerNotifyChannel::Open(const char* server_name)
30 if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) {
31 jack_error("Cannot connect to server pipe");
32 return -1;
33 } else {
34 return 0;
38 void JackWinNamedPipeServerNotifyChannel::Close()
40 fRequestPipe.Close();
44 The requirement is that the Notification from RT thread can be delivered... not sure using a pipe is adequate here...
45 Can the write operation block?
46 A non blocking write operation shoud be used : check if write can succeed, and ignore the notification otherwise
47 (since its mainly used for XRun, ignoring a notification is OK, successive XRun will come...)
49 void JackWinNamedPipeServerNotifyChannel::Notify(int refnum, int notify, int value)
51 JackClientNotificationRequest req(refnum, notify, value);
52 if (req.Write(&fRequestPipe) < 0) {
53 jack_error("Could not write request ref = %ld notify = %ld", refnum, notify);
57 } // end of namespace