3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2016 Christian Schoenebeck * |
* Copyright (C) 2005 - 2020 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
380 |
} |
} |
381 |
|
|
382 |
int LSCPServer::Main() { |
int LSCPServer::Main() { |
383 |
|
#if DEBUG |
384 |
|
Thread::setNameOfCaller("LSCPServer"); |
385 |
|
#endif |
386 |
|
|
387 |
#if defined(WIN32) |
#if defined(WIN32) |
388 |
WSADATA wsaData; |
WSADATA wsaData; |
389 |
int iResult; |
int iResult; |
450 |
timeval timeout; |
timeval timeout; |
451 |
|
|
452 |
while (true) { |
while (true) { |
453 |
#if CONFIG_PTHREAD_TESTCANCEL |
|
454 |
TestCancel(); |
TestCancel(); |
455 |
#endif |
|
456 |
|
// prevent thread from being cancelled |
457 |
|
// (e.g. to prevent deadlocks while holding mutex lock(s)) |
458 |
|
pushCancelable(false); |
459 |
|
|
460 |
// check if some engine channel's parameter / status changed, if so notify the respective LSCP event subscribers |
// check if some engine channel's parameter / status changed, if so notify the respective LSCP event subscribers |
461 |
{ |
{ |
462 |
LockGuard lock(EngineChannelFactory::EngineChannelsMutex); |
LockGuard lock(EngineChannelFactory::EngineChannelsMutex); |
541 |
bufferedNotifies.clear(); |
bufferedNotifies.clear(); |
542 |
} |
} |
543 |
|
|
544 |
|
// now allow thread being cancelled again |
545 |
|
// (since all mutexes are now unlocked) |
546 |
|
popCancelable(); |
547 |
|
|
548 |
fd_set selectSet = fdSet; |
fd_set selectSet = fdSet; |
549 |
timeout.tv_sec = 0; |
timeout.tv_sec = 0; |
550 |
timeout.tv_usec = 100000; |
timeout.tv_usec = 100000; |