* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id$
*/
#include <iostream>
#include <unistd.h>
#include <fcntl.h>
+#include <pbd/pthread_utils.h>
+
#include <ardour/osc.h>
#include <ardour/session.h>
#include <ardour/route.h>
OSC::start ()
{
char tmpstr[255];
+
+ if (_osc_server) {
+ /* already started */
+ return 0;
+ }
for (int j=0; j < 20; ++j) {
snprintf(tmpstr, sizeof(tmpstr), "%d", _port);
int
OSC::stop ()
{
+ if (_osc_server == 0) {
+ /* already stopped */
+ return 0;
+ }
+
+ // stop server thread
+ terminate_osc_thread();
+
lo_server_free (_osc_server);
+ _osc_server = 0;
if (!_osc_unix_socket_path.empty()) {
// unlink it
unlink(_osc_unix_socket_path.c_str());
}
- // stop server thread
- terminate_osc_thread();
-
return 0;
}
return false;
}
- pthread_create (&_osc_thread, NULL, &OSC::_osc_receiver, this);
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setstacksize(&attr, 500000);
+
+ pthread_create (&_osc_thread, &attr, &OSC::_osc_receiver, this);
if (!_osc_thread) {
return false;
}
+ pthread_attr_destroy(&attr);
//pthread_detach (_osc_thread);
return true;
void *
OSC::_osc_receiver(void * arg)
{
+ PBD::ThreadCreated (pthread_self(), X_("OSC"));
+
static_cast<OSC*> (arg)->osc_receiver();
return 0;
}
if ((ret = poll (pfd, nfds, timeout)) < 0) {
if (errno == EINTR) {
/* gdb at work, perhaps */
- cerr << "EINTR hit " << endl;
goto again;
}
OSC::set_session (Session& s)
{
session = &s;
- session->going_away.connect (mem_fun (*this, &OSC::session_going_away));
+ session->GoingAway.connect (mem_fun (*this, &OSC::session_going_away));
}
void