21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# include <pthread_np.h>
#endif
#ifdef OF_HAIKU
# include <kernel/OS.h>
#endif
#import "thread.h"
#import "macros.h"
static int minPrio = 0, maxPrio = 0, normalPrio = 0;
struct thread_ctx {
void (*function)(id object);
id object;
const char *name;
};
/*
* This is done here to make sure this is done as early as possible in the main
|
|
>
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# include <pthread_np.h>
#endif
#ifdef OF_HAIKU
# include <kernel/OS.h>
#endif
#import "OFPlainThread.h"
#import "macros.h"
static int minPrio = 0, maxPrio = 0, normalPrio = 0;
struct ThreadContext {
void (*function)(id object);
id object;
const char *name;
};
/*
* This is done here to make sure this is done as early as possible in the main
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
pthread_attr_destroy(&attr);
}
}
static void *
functionWrapper(void *data)
{
struct thread_ctx *ctx = data;
if (ctx->name != NULL)
OFSetThreadName(ctx->name);
pthread_cleanup_push(free, data);
ctx->function(ctx->object);
|
|
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
pthread_attr_destroy(&attr);
}
}
static void *
functionWrapper(void *data)
{
struct ThreadContext *ctx = data;
if (ctx->name != NULL)
OFSetThreadName(ctx->name);
pthread_cleanup_push(free, data);
ctx->function(ctx->object);
|
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
if (error == ENOSYS)
POSIXAttrAvailable = false;
else
return error;
}
@try {
struct thread_ctx *ctx;
if (attr != NULL && POSIXAttrAvailable) {
#ifndef OF_HPUX
struct sched_param param;
#endif
if (attr->priority < -1 || attr->priority > 1)
|
|
|
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
if (error == ENOSYS)
POSIXAttrAvailable = false;
else
return error;
}
@try {
struct ThreadContext *ctx;
if (attr != NULL && POSIXAttrAvailable) {
#ifndef OF_HPUX
struct sched_param param;
#endif
if (attr->priority < -1 || attr->priority > 1)
|