* Cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33937 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
93e60b1a4f
commit
bde1f75946
@ -4,6 +4,7 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "pthread_private.h"
|
#include "pthread_private.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -32,13 +33,13 @@ static int sConcurrencyLevel;
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pthread_destroy_thread(void *data)
|
pthread_destroy_thread(void* data)
|
||||||
{
|
{
|
||||||
pthread_thread *thread = pthread_self();
|
pthread_thread* thread = pthread_self();
|
||||||
|
|
||||||
// call cleanup handlers
|
// call cleanup handlers
|
||||||
while (true) {
|
while (true) {
|
||||||
struct __pthread_cleanup_handler *handler
|
struct __pthread_cleanup_handler* handler
|
||||||
= __pthread_cleanup_pop_handler();
|
= __pthread_cleanup_pop_handler();
|
||||||
if (handler == NULL)
|
if (handler == NULL)
|
||||||
break;
|
break;
|
||||||
@ -54,9 +55,9 @@ pthread_destroy_thread(void *data)
|
|||||||
|
|
||||||
|
|
||||||
static int32
|
static int32
|
||||||
pthread_thread_entry(thread_func _unused, void *_thread)
|
pthread_thread_entry(thread_func _unused, void* _thread)
|
||||||
{
|
{
|
||||||
pthread_thread *thread = (pthread_thread *)_thread;
|
pthread_thread* thread = (pthread_thread*)_thread;
|
||||||
|
|
||||||
// store thread data in TLS
|
// store thread data in TLS
|
||||||
*tls_address(sPthreadSlot) = thread;
|
*tls_address(sPthreadSlot) = thread;
|
||||||
@ -68,15 +69,15 @@ pthread_thread_entry(thread_func _unused, void *_thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - public API
|
// #pragma mark - public API
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
pthread_create(pthread_t *_thread, const pthread_attr_t *_attr,
|
pthread_create(pthread_t* _thread, const pthread_attr_t* _attr,
|
||||||
void *(*startRoutine)(void*), void *arg)
|
void* (*startRoutine)(void*), void* arg)
|
||||||
{
|
{
|
||||||
const pthread_attr *attr = NULL;
|
const pthread_attr* attr = NULL;
|
||||||
pthread_thread *thread;
|
pthread_thread* thread;
|
||||||
struct thread_creation_attributes attributes;
|
struct thread_creation_attributes attributes;
|
||||||
|
|
||||||
if (_thread == NULL)
|
if (_thread == NULL)
|
||||||
@ -90,7 +91,7 @@ pthread_create(pthread_t *_thread, const pthread_attr_t *_attr,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread = (pthread_thread *)malloc(sizeof(pthread_thread));
|
thread = (pthread_thread*)malloc(sizeof(pthread_thread));
|
||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
return EAGAIN;
|
return EAGAIN;
|
||||||
|
|
||||||
@ -136,12 +137,12 @@ pthread_create(pthread_t *_thread, const pthread_attr_t *_attr,
|
|||||||
pthread_t
|
pthread_t
|
||||||
pthread_self(void)
|
pthread_self(void)
|
||||||
{
|
{
|
||||||
pthread_thread *thread;
|
pthread_thread* thread;
|
||||||
|
|
||||||
if (sPthreadSlot == -1)
|
if (sPthreadSlot == -1)
|
||||||
return &sMainThread;
|
return &sMainThread;
|
||||||
|
|
||||||
thread = (pthread_thread *)tls_get(sPthreadSlot);
|
thread = (pthread_thread*)tls_get(sPthreadSlot);
|
||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
return &sMainThread;
|
return &sMainThread;
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ pthread_equal(pthread_t t1, pthread_t t2)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
pthread_join(pthread_t thread, void **_value)
|
pthread_join(pthread_t thread, void** _value)
|
||||||
{
|
{
|
||||||
status_t dummy;
|
status_t dummy;
|
||||||
status_t error = wait_for_thread(thread->id, &dummy);
|
status_t error = wait_for_thread(thread->id, &dummy);
|
||||||
@ -175,7 +176,7 @@ pthread_join(pthread_t thread, void **_value)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pthread_exit(void *value)
|
pthread_exit(void* value)
|
||||||
{
|
{
|
||||||
pthread_self()->exit_value = value;
|
pthread_self()->exit_value = value;
|
||||||
exit_thread(B_OK);
|
exit_thread(B_OK);
|
||||||
|
Loading…
Reference in New Issue
Block a user