pthreads :: NativePthread :: cancel
pthreads :: NativePthread :: create
pthreads :: NativePthread :: create_ex
pthreads :: NativePthread :: defaultinit
pthreads :: NativePthread :: equal
pthreads :: NativePthread :: join
pthreads $ NativePthread :: SELF
Type of this instance, automatically specialized in every classcore :: Pointer :: address_is_null
Is the address behind this Object at NULL?pthreads :: NativePthread :: cancel
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
pthreads :: NativePthread :: create
pthreads :: NativePthread :: create_ex
core :: Object :: defaultinit
pthreads :: NativePthread :: defaultinit
core :: Pointer :: defaultinit
pthreads :: NativePthread :: equal
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
pthreads :: NativePthread :: join
core :: Object :: native_class_name
The class name of the object in CString format.core :: Pointer :: native_equals
core :: Object :: output_class_name
Display class name on stdout (debug only).core :: Pointer :: premultiply_alpha
Multiply RGB values by their alpha value
private extern class NativePthread in "C" `{ pthread_t * `}
new create(nit_thread: Thread) import Thread.main_intern `{
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_t thread;
int r = pthread_create(&thread, &attr, (void * (*)(void *))&Thread_main_intern, nit_thread);
if (r == 0) {
pthread_t *pthread = malloc(sizeof(pthread_t));
memmove(pthread, &thread, sizeof(pthread_t));
return pthread;
}
return NULL;
`}
new create_ex(nit_thread: Thread, attr: NativePthreadAttr) import Thread.main_intern `{
pthread_t thread;
int r = pthread_create(&thread, attr, (void * (*)(void *))&Thread_main_intern, nit_thread);
if (r == 0) {
pthread_t *pthread = malloc(sizeof(pthread_t));
memmove(pthread, &thread, sizeof(pthread_t));
return pthread;
}
return NULL;
`}
fun join: nullable Object `{
void *thread_return;
pthread_join(*self, &thread_return);
if(thread_return == NULL) thread_return = null_Object();
return (nullable_Object)thread_return;
`}
fun equal(other: NativePthread): Bool `{ return pthread_equal(*self, *other); `}
fun kill(signal: Int): Int `{ return pthread_kill(*self, (int)signal); `}
end
lib/pthreads/pthreads.nit:139,1--178,3
redef extern class NativePthread
fun cancel: Bool `{
return pthread_cancel(*self);
`}
end
lib/pthreads/extra.nit:33,1--37,3