diff options
Diffstat (limited to 'src/mdaLooplex.cpp')
-rw-r--r-- | src/mdaLooplex.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/mdaLooplex.cpp b/src/mdaLooplex.cpp index 8c4fcdc..0cf408d 100644 --- a/src/mdaLooplex.cpp +++ b/src/mdaLooplex.cpp @@ -120,27 +120,27 @@ IdleList::IdleList(mdaLooplex *effect, IdleList *next) : effect(effect), next(ne timer = SetTimer(NULL, 0, IDLE_MSEC, TimerCallback); #elif __linux__ timer = 1; - pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setstacksize(&attr, 16 * 1024);
+ pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 16 * 1024); int policy; -
- if (pthread_attr_getschedpolicy(&attr, &policy) == 0)
- {
- struct sched_param param;
- param.sched_priority = sched_get_priority_min(policy);
- pthread_attr_setschedpolicy(&attr, SCHED_OTHER);
- pthread_attr_setschedparam(&attr, ¶m);
- }
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
-
- if (pthread_create(&thread, &attr, &ThreadCallback, 0) != 0)
- {
+ + if (pthread_attr_getschedpolicy(&attr, &policy) == 0) + { + struct sched_param param; + param.sched_priority = sched_get_priority_min(policy); + pthread_attr_setschedpolicy(&attr, SCHED_OTHER); + pthread_attr_setschedparam(&attr, ¶m); + } + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0); + + if (pthread_create(&thread, &attr, &ThreadCallback, 0) != 0) + { thread = 0; - timer = 0;
- fprintf(stderr, "Error: mdaLooplex.cpp (line %d)\n", __LINE__);
- }
+ timer = 0; + fprintf(stderr, "Error: mdaLooplex.cpp (line %d)\n", __LINE__); + } pthread_attr_destroy(&attr); #else //OSX double ms = kEventDurationMillisecond * (double)IDLE_MSEC; |