Browse Source

Tim Blechmann RAII idiom patch for JackServer ressource initialization.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2334 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 17 years ago
parent
commit
4d78df880e
4 changed files with 25 additions and 5 deletions
  1. +4
    -0
      ChangeLog
  2. +18
    -2
      common/JackGlobals.h
  3. +0
    -2
      common/JackServer.cpp
  4. +3
    -1
      common/JackServer.h

+ 4
- 0
ChangeLog View File

@@ -20,6 +20,10 @@ Fernando Lopez-Lezcano
Jackdmp changes log Jackdmp changes log
--------------------------- ---------------------------


2008-05-24 Stephane Letz <letz@grame.fr>

* Tim Blechmann RAII idiom patch for JackServer ressource initialization.

2008-05-23 Stephane Letz <letz@grame.fr> 2008-05-23 Stephane Letz <letz@grame.fr>


* Use StartSync to start the client notification thread, otherwise initial notifications from the server may be lost. * Use StartSync to start the client notification thread, otherwise initial notifications from the server may be lost.


+ 18
- 2
common/JackGlobals.h View File

@@ -280,13 +280,29 @@ class JackGlobals


}; };


namespace detail
{
struct JackGlobalsServerInitializer
{
JackGlobalsServerInitializer(void)
{
JackGlobals::InitServer();
}

~JackGlobalsServerInitializer(void)
{
JackGlobals::Destroy();
}
};
}

} // end of namespace } // end of namespace


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif #endif
extern jack_tls_key gRealTime; extern jack_tls_key gRealTime;


#ifdef WIN32 #ifdef WIN32
@@ -295,7 +311,7 @@ EXPORT void jack_init();
EXPORT void jack_uninit(); EXPORT void jack_uninit();


#else #else
void __attribute__ ((constructor)) jack_init(); void __attribute__ ((constructor)) jack_init();
void __attribute__ ((destructor)) jack_uninit(); void __attribute__ ((destructor)) jack_uninit();




+ 0
- 2
common/JackServer.cpp View File

@@ -44,7 +44,6 @@ JackServer* JackServer::fInstance = NULL;


JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name) JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name)
{ {
JackGlobals::InitServer();
for (int i = 0; i < CLIENT_NUM; i++) for (int i = 0; i < CLIENT_NUM; i++)
fSynchroTable[i] = JackGlobals::MakeSynchro(); fSynchroTable[i] = JackGlobals::MakeSynchro();
fGraphManager = new JackGraphManager(); fGraphManager = new JackGraphManager();
@@ -76,7 +75,6 @@ JackServer::~JackServer()
UnloadDriverModule(fDriverInfo->handle); UnloadDriverModule(fDriverInfo->handle);
free(fDriverInfo); free(fDriverInfo);
} }
JackGlobals::Destroy();
} }


// TODO : better handling of intermediate failing cases... // TODO : better handling of intermediate failing cases...


+ 3
- 1
common/JackServer.h View File

@@ -27,6 +27,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackConnectionManager.h" #include "JackConnectionManager.h"
#include "jslist.h" #include "jslist.h"


#include "JackGlobals.h"

namespace Jack namespace Jack
{ {


@@ -41,7 +43,7 @@ class JackEngineInterface;
\brief The Jack server. \brief The Jack server.
*/ */


class EXPORT JackServer
class EXPORT JackServer : private detail::JackGlobalsServerInitializer
{ {


private: private:


Loading…
Cancel
Save