Skip to content
Snippets Groups Projects
Commit 2de9619f authored by Christian Mehlis's avatar Christian Mehlis
Browse files

Merge pull request #758 from Kijewski/issue-755

Fix `pthread_self()` confusion
parents 668c29ca ca4337ab
No related branches found
No related tags found
No related merge requests found
...@@ -51,9 +51,10 @@ enum pthread_thread_status { ...@@ -51,9 +51,10 @@ enum pthread_thread_status {
}; };
typedef struct pthread_thread { typedef struct pthread_thread {
int thread_pid;
enum pthread_thread_status status; enum pthread_thread_status status;
int joining_thread; int joining_thread;
int thread_pid;
void *returnval; void *returnval;
bool should_cancel; bool should_cancel;
...@@ -159,6 +160,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta ...@@ -159,6 +160,7 @@ int pthread_create(pthread_t *newthread, const pthread_attr_t *attr, void *(*sta
void pthread_exit(void *retval) void pthread_exit(void *retval)
{ {
pthread_thread_t *self = pthread_sched_threads[pthread_self()]; pthread_thread_t *self = pthread_sched_threads[pthread_self()];
self->thread_pid = -1;
DEBUG("pthread_exit(%p), self == %p\n", retval, (void *) self); DEBUG("pthread_exit(%p), self == %p\n", retval, (void *) self);
if (self->status != PTS_DETACHED) { if (self->status != PTS_DETACHED) {
self->returnval = retval; self->returnval = retval;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment