void
AutomationWatch::thread ()
{
- pbd_set_thread_priority (pthread_self(), SCHED_FIFO, -25);
+ pbd_set_thread_priority (pthread_self(), PBD_SCHED_FIFO, -25);
while (_run_thread) {
Glib::usleep ((gulong) floor (Config->get_automation_interval_msecs() * 1000));
timer ();
_run = true;
_port_change_flag = false;
- if (pbd_realtime_pthread_create (SCHED_FIFO, -20, 100000,
+ if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, -20, 100000,
&_main_thread, pthread_process, this))
{
if (pthread_create (&_main_thread, NULL, pthread_process, this))
ThreadData* td = new ThreadData (this, func, stacksize);
- if (pbd_realtime_pthread_create (SCHED_FIFO, -22, stacksize,
+ if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, -22, stacksize,
&thread_id, alsa_process_thread, td)) {
pthread_attr_init (&attr);
pthread_attr_setstacksize (&attr, stacksize);
int
AlsaMidiIO::start ()
{
- if (pbd_realtime_pthread_create (SCHED_FIFO, -21, 100000,
+ if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, -21, 100000,
&_main_thread, pthread_process, this))
{
if (pthread_create (&_main_thread, NULL, pthread_process, this)) {
ThreadData* td = new ThreadData (this, func, stacksize);
- if (pbd_realtime_pthread_create (SCHED_FIFO, -22, stacksize,
+ if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, -22, stacksize,
&thread_id, coreaudio_process_thread, td)) {
pthread_attr_init (&attr);
pthread_attr_setstacksize (&attr, stacksize);
bool
PortAudioBackend::start_blocking_process_thread ()
{
- if (pbd_realtime_pthread_create (SCHED_FIFO, -20, 100000,
+ if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, -20, 100000,
&_main_blocking_thread, blocking_thread_func, this))
{
if (pthread_create (&_main_blocking_thread, NULL, blocking_thread_func, this))
ThreadData* td = new ThreadData (this, func, stacksize);
- if (pbd_realtime_pthread_create (SCHED_FIFO, -22, stacksize,
+ if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, -22, stacksize,
&thread_id, portaudio_process_thread, td)) {
pthread_attr_init (&attr);
pthread_attr_setstacksize (&attr, stacksize);
size_t stacksize = 100000;
// TODO Use native threads
- if (pbd_realtime_pthread_create (SCHED_FIFO, -21, stacksize,
+ if (pbd_realtime_pthread_create (PBD_SCHED_FIFO, -21, stacksize,
&m_output_thread_handle, midi_output_thread, this)) {
return false;
}
#include "pbd/libpbd_visibility.h"
#include "pbd/crossthread.h"
#include "pbd/event_loop.h"
+#include "pbd/pthread_utils.h"
/** A BaseUI is an abstraction designed to be used with any "user
* interface" (not necessarily graphical) that needs to wait on
virtual void thread_init () {};
- int set_thread_priority (const int policy = SCHED_FIFO, int priority = 0) const;
+ int set_thread_priority (const int policy = PBD_SCHED_FIFO, int priority = 0) const;
/** Called when there input ready on the request_channel
*/
LIBPBD_API extern PBD::Signal3<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
}
+/* pthread-w32 does not support realtime scheduling
+ * (well, windows, doesn't..) and only supports SetThreadPriority()
+ *
+ * pthread_setschedparam() returns ENOTSUP if the policy is not SCHED_OTHER.
+ *
+ * however, pthread_create() with attributes, ignores the policy and
+ * only sets the priority (when PTHREAD_EXPLICIT_SCHED is used).
+ */
+#ifdef PLATFORM_WINDOWS
+#define PBD_SCHED_FIFO SCHED_OTHER
+#else
+#define PBD_SCHED_FIFO SCHED_FIFO
+#endif
#endif /* __pbd_pthread_utils__ */