/[svn]/linuxsampler/trunk/src/common/Thread.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Thread.cpp

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

revision 1481 by senoner, Wed Nov 14 23:42:15 2007 UTC revision 2185 by persson, Sun Jun 19 09:09:38 2011 UTC
# Line 3  Line 3 
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 - 2007 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2011 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program 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  *
# Line 23  Line 23 
23    
24  #include "Thread.h"  #include "Thread.h"
25    
26    #if HAVE_CONFIG_H
27    # include <config.h>
28    #endif
29    
30  // this is the minimum stack size a thread will be spawned with  // this is the minimum stack size a thread will be spawned with
31  // if this value is too small, the OS will allocate memory on demand and  // if this value is too small, the OS will allocate memory on demand and
32  // thus might lead to dropouts in realtime threads  // thus might lead to dropouts in realtime threads
# Line 150  int Thread::SignalStartThread() { Line 154  int Thread::SignalStartThread() {
154          RunningCondition.Set(false);          RunningCondition.Set(false);
155          return res;          return res;
156      }      }
157    
158      // Create and run the thread      // Create and run the thread
159      res = pthread_create(&this->__thread_id, &__thread_attr, __pthread_launcher, this);      res = pthread_create(&this->__thread_id, &__thread_attr, __pthread_launcher, this);
160      switch (res) {      switch (res) {
# Line 218  int Thread::SignalStopThread() { Line 223  int Thread::SignalStopThread() {
223      #else      #else
224      RunningCondition.Set(false);      RunningCondition.Set(false);
225      #endif      #endif
226  #else    #else
227      pthread_cancel(__thread_id);      pthread_cancel(__thread_id);
228  #endif    #endif  
229      return 0;      return 0;
# Line 362  int Thread::Destructor() { Line 367  int Thread::Destructor() {
367      return 0;      return 0;
368  }  }
369    
370    void Thread::TestCancel() {
371    #if CONFIG_PTHREAD_TESTCANCEL
372        pthread_testcancel();
373    #endif
374    }
375    
376  #if defined(WIN32)  #if defined(WIN32)
377  DWORD WINAPI __win32thread_launcher(LPVOID lpParameter) {  DWORD WINAPI __win32thread_launcher(LPVOID lpParameter) {
378      Thread* t;      Thread* t;
# Line 375  DWORD WINAPI __win32thread_launcher(LPVO Line 386  DWORD WINAPI __win32thread_launcher(LPVO
386  #else  #else
387  /// Callback function for the POSIX thread API  /// Callback function for the POSIX thread API
388  static void* __pthread_launcher(void* thread) {  static void* __pthread_launcher(void* thread) {
389    #if !CONFIG_PTHREAD_TESTCANCEL
390      pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); // let the thread be killable under any circumstances      pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); // let the thread be killable under any circumstances
391    #endif
392    
393      Thread* t;      Thread* t;
394      t = (Thread*) thread;      t = (Thread*) thread;
395      t->SetSchedulingPriority();      t->SetSchedulingPriority();

Legend:
Removed from v.1481  
changed lines
  Added in v.2185

  ViewVC Help
Powered by ViewVC