RemotePlugin: added support for running remote process multiple times

There might be situations where we want to try to run multiple different
remote processes. Therefore introduced RemotePlugin::init(...) which can
be called multiple times even if previous calls failed.
This commit is contained in:
Tobias Doerffel
2010-12-23 22:09:45 +01:00
parent 5143b6ad21
commit 39cc1a8212
2 changed files with 52 additions and 29 deletions

View File

@@ -1,7 +1,7 @@
/*
* RemotePlugin.h - base class providing RPC like mechanisms
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -603,6 +603,14 @@ public:
RemotePluginBase( shmFifo * _in, shmFifo * _out );
virtual ~RemotePluginBase();
void reset( shmFifo *in, shmFifo *out )
{
delete m_in;
delete m_out;
m_in = in;
m_out = out;
}
void sendMessage( const message & _m );
message receiveMessage();
@@ -696,8 +704,7 @@ private:
class EXPORT RemotePlugin : public RemotePluginBase
{
public:
RemotePlugin( const QString & _plugin_executable,
bool _wait_for_init_done = true );
RemotePlugin();
virtual ~RemotePlugin();
inline bool isRunning()
@@ -709,6 +716,8 @@ public:
#endif
}
bool init( const QString &pluginExecutable, bool waitForInitDoneMsg );
inline void waitForInitDone( bool _busyWaiting = true )
{
m_failed = waitForMessage( IdInitDone, _busyWaiting ).id != IdInitDone;