Browse Source

Compiles on Windows again.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3854 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.5
sletz 15 years ago
parent
commit
a46d156ea3
3 changed files with 38 additions and 15 deletions
  1. +28
    -15
      windows/JackWinNamedPipeServerChannel.cpp
  2. +9
    -0
      windows/JackWinNamedPipeServerNotifyChannel.cpp
  3. +1
    -0
      windows/JackWinNamedPipeServerNotifyChannel.h

+ 28
- 15
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -24,6 +24,8 @@ Copyright (C) 2004-2006 Grame
#include "JackLockedEngine.h"
#include "JackGlobals.h"
#include "JackClient.h"
#include "JackNotification.h"
#include "JackException.h"
#include <assert.h>

using namespace std;
@@ -57,7 +59,7 @@ int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client con
jack_error("Cannot start Jack server listener\n");
return -1;
}
fServer = server;
return 0;
}
@@ -71,15 +73,20 @@ void JackClientPipeThread::Close() // Close the Server/Client connection
all ressources will be desallocated at the end.
*/

fThread.Kill();
fThread.Stop();
fPipe->Close();
fRefNum = -1;
}
bool JackClientPipeThread::Execute()
{
jack_log("JackClientPipeThread::Execute");
return(HandleRequest());
try{
jack_log("JackClientPipeThread::Execute");
return (HandleRequest());
} catch (JackQuitException& e) {
jack_log("JackMachServerChannel::Execute JackQuitException");
return false;
}
}

bool JackClientPipeThread::HandleRequest()
@@ -307,8 +314,14 @@ bool JackClientPipeThread::HandleRequest()
case JackRequest::kNotification: {
jack_log("JackRequest::Notification");
JackClientNotificationRequest req;
if (req.Read(fPipe) == 0)
fServer->Notify(req.fRefNum, req.fNotify, req.fValue);
if (req.Read(fPipe) == 0) {
if (req.fNotify == kQUIT) {
jack_log("JackRequest::Notification kQUIT");
throw JackQuitException();
} else {
fServer->Notify(req.fRefNum, req.fNotify, req.fValue);
}
}
break;
}

@@ -317,7 +330,7 @@ bool JackClientPipeThread::HandleRequest()
break;
}
}
// Unlock the global mutex
ReleaseMutex(fMutex);
return ret;
@@ -373,17 +386,17 @@ int JackWinNamedPipeServerChannel::Open(const char* server_name, JackServer* ser
{
jack_log("JackWinNamedPipeServerChannel::Open ");
snprintf(fServerName, sizeof(fServerName), server_name);
// Needed for internal connection from JackWinNamedPipeServerNotifyChannel object
if (fRequestListenPipe.Bind(jack_server_dir, server_name, 0) < 0) {
jack_error("JackWinNamedPipeServerChannel::Open : cannot create result listen pipe");
return -1;
}
fServer = server;
return 0;
}
void JackWinNamedPipeServerChannel::Close()
{
/* TODO : solve WIN32 thread Kill issue
@@ -403,11 +416,11 @@ int JackWinNamedPipeServerChannel::Start()
if (fThread.Start() != 0) {
jack_error("Cannot start Jack server listener");
return -1;
}
}
return 0;
}
}
bool JackWinNamedPipeServerChannel::Init()
{
jack_log("JackWinNamedPipeServerChannel::Init ");


+ 9
- 0
windows/JackWinNamedPipeServerNotifyChannel.cpp View File

@@ -21,6 +21,7 @@ This program is free software; you can redistribute it and/or modify
#include "JackError.h"
#include "JackRequest.h"
#include "JackConstants.h"
#include "JackNotification.h"

namespace Jack
{
@@ -54,6 +55,14 @@ void JackWinNamedPipeServerNotifyChannel::Notify(int refnum, int notify, int val
}
}

void JackWinNamedPipeServerNotifyChannel::NotifyQuit()
{
JackClientNotificationRequest req(-1, kQUIT, 0);
if (req.Write(&fRequestPipe) < 0) {
jack_error("Could not write request ref = %d notify = %d", -1, kQUIT);
}
}

} // end of namespace



+ 1
- 0
windows/JackWinNamedPipeServerNotifyChannel.h View File

@@ -45,6 +45,7 @@ class JackWinNamedPipeServerNotifyChannel
void Close();

void Notify(int refnum, int notify, int value);
void NotifyQuit();
};

} // end of namespace


Loading…
Cancel
Save