/[svn]/linuxsampler/trunk/src/shell/LSCPClient.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/shell/LSCPClient.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3765 by schoenebeck, Thu Dec 15 12:47:45 2016 UTC revision 3766 by schoenebeck, Mon Apr 6 12:41:49 2020 UTC
# Line 1  Line 1 
1  /*  /*
2   * LSCP Shell   * LSCP Shell
3   *   *
4   * Copyright (c) 2014 - 2016 Christian Schoenebeck   * Copyright (c) 2014 - 2020 Christian Schoenebeck
5   *   *
6   * This program is part of LinuxSampler and released under the same terms.   * This program is part of LinuxSampler and released under the same terms.
7   */   */
# Line 316  optional<String> LSCPClient::receiveLine Line 316  optional<String> LSCPClient::receiveLine
316   * internal FIFO buffer.   * internal FIFO buffer.
317   */   */
318  int LSCPClient::Main() {  int LSCPClient::Main() {
319        #if DEBUG
320        Thread::setNameOfCaller("LSCPClient");
321        #endif
322    
323      while (true) {      while (true) {
324          optional<String> pLine = receiveLine();          optional<String> pLine = receiveLine();
325    
326            // prevent thread from being cancelled
327            // (e.g. to prevent deadlocks while holding mutex lock(s))
328            pushCancelable(false);
329    
330          if (pLine) { // if there was a line received ...          if (pLine) { // if there was a line received ...
331              //lscpLog("[client receiveLine] '%s'\n", pLine->c_str());              //lscpLog("[client receiveLine] '%s'\n", pLine->c_str());
332              String s = *pLine;              String s = *pLine;
# Line 348  int LSCPClient::Main() { Line 357  int LSCPClient::Main() {
357              if (m_sync.GetUnsafe()) m_sync.Set(false);              if (m_sync.GetUnsafe()) m_sync.Set(false);
358              else if (m_callback) (*m_callback)(this);              else if (m_callback) (*m_callback)(this);
359          } else if (m_errorCallback) (*m_errorCallback)(this);          } else if (m_errorCallback) (*m_errorCallback)(this);
360    
361            // now allow thread being cancelled again
362            // (since all mutexes are now unlocked)
363            popCancelable();
364    
365          TestCancel();          TestCancel();
366      }      }
367      return 0; // just to avoid a warning with some old compilers      return 0; // just to avoid a warning with some old compilers

Legend:
Removed from v.3765  
changed lines
  Added in v.3766

  ViewVC Help
Powered by ViewVC