Cleanup
[jack2.git] / common / JackFreewheelDriver.cpp
blob389c1e12cdff38749b1b3ffceda90b495a8e38e2
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2006 Grame
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifdef WIN32
22 #pragma warning (disable : 4786)
23 #endif
25 #include "JackFreewheelDriver.h"
26 #include "JackEngineControl.h"
27 #include "JackEngine.h"
29 namespace Jack
32 int JackFreewheelDriver::Process()
34 if (fIsMaster) {
35 JackLog("JackFreewheelDriver::Process master %lld\n", fEngineControl->fTimeOutUsecs);
36 fLastWaitUst = GetMicroSeconds();
37 fEngine->Process(fLastWaitUst);
38 fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
39 if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs * 20) < 0) // Wait for all clients to finish
40 jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
41 } else {
42 fGraphManager->ResumeRefNum(fClientControl, fSynchroTable); // Signal all clients
43 if (fEngineControl->fSyncMode) {
44 if (fGraphManager->SuspendRefNum(fClientControl, fSynchroTable, fEngineControl->fTimeOutUsecs) < 0) {
45 jack_error("JackFreewheelDriver::ProcessSync SuspendRefNum error");
46 return -1;
50 return 0;
53 } // end of namespace