2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2008 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 #ifndef __JackWaitThreadedDriver__
22 #define __JackWaitThreadedDriver__
24 #include "JackThreadedDriver.h"
25 #include "JackTimedDriver.h"
31 \brief To be used as a wrapper of JackNetDriver.
33 The idea is to behave as the "dummy" driver, until the network connection is really started and processing starts.
34 The Execute method will call the Process method from the base JackTimedDriver, until the decorated driver Init method returns.
35 A helper JackDriverStarter thread is used for that purpose.
38 class SERVER_EXPORT JackWaitThreadedDriver
: public JackThreadedDriver
42 struct JackDriverStarter
: public JackRunnableInterface
47 volatile bool fRunning
;
49 JackDriverStarter(JackDriver
* driver
)
50 :fDriver(driver
), fThread(this), fRunning(false)
61 return fThread
.Start();
64 // JackRunnableInterface interface
67 // Blocks until decorated driver is started (that is when it's Initialize method returns).
68 if (fDriver
->Initialize()) {
71 jack_error("Initing net driver fails...");
79 JackDriverStarter fStarter
;
83 JackWaitThreadedDriver(JackDriver
* net_driver
)
84 : JackThreadedDriver(net_driver
), fStarter(net_driver
)
86 virtual ~JackWaitThreadedDriver()
89 // JackRunnableInterface interface