Created
September 21, 2010 21:30
-
-
Save koush/590606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <pthread.h> | |
typedef struct pthread_internal_t | |
{ | |
struct pthread_internal_t* next; | |
struct pthread_internal_t** pref; | |
pthread_attr_t attr; | |
pid_t kernel_id; | |
pthread_cond_t join_cond; | |
int join_count; | |
void* return_value; | |
int intern; | |
__pthread_cleanup_t* cleanup_stack; | |
void** tls; /* thread-local storage area */ | |
} pthread_internal_t; | |
int main(int argc, char** argv) { | |
int pid = fork(); | |
int self = pthread_self(); | |
pthread_internal_t* t = (pthread_internal_t*)self; | |
printf("%d %d %d\n", pid, t->kernel_id, gettid()); | |
// 7196 7195 7195 | |
// 0 7195 7196 | |
// Note that the internal kernel ids are the SAME after fork. This is wrong! | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment