Dmitry Baikov jackmp-time patch: add jack_get_time, jack_time_to_frames, jack_frames_...
[jack2.git] / common / JackSocketServerNotifyChannel.cpp
blob3ca024a12103699050769532c11580f7facabedb
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 "JackSocketServerNotifyChannel.h"
21 #include "JackError.h"
22 #include "JackRequest.h"
23 #include "JackConstants.h"
25 namespace Jack
28 int JackSocketServerNotifyChannel::Open()
30 if (fRequestSocket.Connect(jack_server_dir, 0) < 0) {
31 jack_error("Cannot connect to server socket");
32 return -1;
33 } else {
34 return 0;
38 void JackSocketServerNotifyChannel::Close()
40 fRequestSocket.Close();
44 The requirement is that the Notification from RT thread can be delivered... not sure using a socket 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 JackSocketServerNotifyChannel::ClientNotify(int refnum, int notify, int value)
51 JackClientNotificationRequest req(refnum, notify, value);
52 if (req.Write(&fRequestSocket) < 0) {
53 jack_error("Could not write request type = %ld", req.fType);
57 } // end of namespace