NO-OP: whitespace
This commit is contained in:
parent
21b8885fe9
commit
c7bce4b685
|
@ -18,10 +18,10 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#ifndef PLATFORM_WINDOWS
|
||||
#include <dlfcn.h>
|
||||
|
@ -41,9 +41,9 @@ DECLARE_DEFAULT_COMPARISONS(pthread_t) // Needed for 'DECLARE_DEFAULT_COMPARISO
|
|||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <mach/thread_policy.h>
|
||||
#include <mach/thread_act.h>
|
||||
#include <mach/mach_time.h>
|
||||
#include <mach/thread_act.h>
|
||||
#include <mach/thread_policy.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
@ -53,13 +53,15 @@ static ThreadMap all_threads;
|
|||
static pthread_mutex_t thread_map_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static Glib::Threads::Private<char> thread_name (free);
|
||||
|
||||
namespace PBD {
|
||||
namespace PBD
|
||||
{
|
||||
PBD::Signal3<void, pthread_t, std::string, uint32_t> ThreadCreatedWithRequestSize;
|
||||
}
|
||||
|
||||
using namespace PBD;
|
||||
|
||||
static int thread_creator (pthread_t* thread_id, const pthread_attr_t* attr, void *(*function)(void*), void* arg)
|
||||
static int
|
||||
thread_creator (pthread_t* thread_id, const pthread_attr_t* attr, void* (*function) (void*), void* arg)
|
||||
{
|
||||
#ifdef WINE_THREAD_SUPPORT
|
||||
return wine_pthread_create (thread_id, attr, function, arg);
|
||||
|
@ -68,7 +70,6 @@ static int thread_creator (pthread_t* thread_id, const pthread_attr_t* attr, voi
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PBD::notify_event_loops_about_thread_creation (pthread_t thread, const std::string& emitting_thread_name, int request_count)
|
||||
{
|
||||
|
@ -88,7 +89,10 @@ struct ThreadStartWithName {
|
|||
std::string name;
|
||||
|
||||
ThreadStartWithName (void* (*f) (void*), void* a, const std::string& s)
|
||||
: thread_work (f), arg (a), name (s) {}
|
||||
: thread_work (f)
|
||||
, arg (a)
|
||||
, name (s)
|
||||
{}
|
||||
};
|
||||
|
||||
static void*
|
||||
|
@ -99,19 +103,15 @@ fake_thread_start (void* arg)
|
|||
void* thread_arg = ts->arg;
|
||||
|
||||
/* name will be deleted by the default handler for GStaticPrivate, when the thread exits */
|
||||
|
||||
pthread_set_name (ts->name.c_str ());
|
||||
|
||||
/* we don't need this object anymore */
|
||||
|
||||
delete ts;
|
||||
|
||||
/* actually run the thread's work function */
|
||||
|
||||
void* ret = thread_work (thread_arg);
|
||||
|
||||
/* cleanup */
|
||||
|
||||
pthread_mutex_lock (&thread_map_lock);
|
||||
|
||||
for (ThreadMap::iterator i = all_threads.begin (); i != all_threads.end (); ++i) {
|
||||
|
@ -124,7 +124,6 @@ fake_thread_start (void* arg)
|
|||
pthread_mutex_unlock (&thread_map_lock);
|
||||
|
||||
/* done */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -134,7 +133,7 @@ pthread_create_and_store (string name, pthread_t *thread, void * (*start_routin
|
|||
pthread_attr_t default_attr;
|
||||
int ret;
|
||||
|
||||
// set default stack size to sensible default for memlocking
|
||||
/* set default stack size to sensible default for memlocking */
|
||||
pthread_attr_init (&default_attr);
|
||||
pthread_attr_setstacksize (&default_attr, 0x80000); // 512kB
|
||||
|
||||
|
@ -155,7 +154,6 @@ void
|
|||
pthread_set_name (const char* str)
|
||||
{
|
||||
/* copy string and delete it when exiting */
|
||||
|
||||
thread_name.set (strdup (str)); // leaks
|
||||
|
||||
#if !defined PLATFORM_WINDOWS && defined _GNU_SOURCE
|
||||
|
@ -197,7 +195,6 @@ pthread_cancel_all ()
|
|||
pthread_mutex_lock (&thread_map_lock);
|
||||
|
||||
for (ThreadMap::iterator i = all_threads.begin (); i != all_threads.end ();) {
|
||||
|
||||
ThreadMap::iterator nxt = i;
|
||||
++nxt;
|
||||
|
||||
|
@ -226,7 +223,8 @@ pthread_cancel_one (pthread_t thread)
|
|||
pthread_mutex_unlock (&thread_map_lock);
|
||||
}
|
||||
|
||||
static size_t pbd_stack_size ()
|
||||
static size_t
|
||||
pbd_stack_size ()
|
||||
{
|
||||
size_t rv = 0;
|
||||
#ifndef PLATFORM_WINDOWS
|
||||
|
@ -297,8 +295,10 @@ pbd_absolute_rt_priority (int policy, int priority)
|
|||
} else {
|
||||
priority += p_max;
|
||||
}
|
||||
if (priority > p_max) priority = p_max;
|
||||
if (priority < p_min) priority = p_min;
|
||||
if (priority > p_max)
|
||||
priority = p_max;
|
||||
if (priority < p_min)
|
||||
priority = p_min;
|
||||
return priority;
|
||||
}
|
||||
|
||||
|
@ -346,8 +346,8 @@ pbd_mach_set_realtime_policy (pthread_t thread_id, double period_ns)
|
|||
mach_msg_type_number_t msgt = 4;
|
||||
boolean_t dflt = false;
|
||||
kern_return_t rv = thread_policy_get (pthread_mach_thread_np (thread_id),
|
||||
THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t) &policy,
|
||||
&msgt, &dflt);
|
||||
THREAD_TIME_CONSTRAINT_POLICY, (thread_policy_t)&policy, &msgt, &dflt);
|
||||
|
||||
printf ("Mach Thread(%p) get: period=%d comp=%d constraint=%d preemt=%d OK: %d\n", thread_id, policy.period, policy.computation, policy.constraint, policy.preemptible, rv == KERN_SUCCESS);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user