* commit '2bb873aee94db4f317a62480b07f6d4d1d33da6d': Remove PTHREAD_ATTR_FLAG_MAIN_THREAD.
This commit is contained in:
		@@ -88,7 +88,6 @@ void __libc_init_tls(KernelArgumentBlock& args) {
 | 
				
			|||||||
  // The main thread has no mmap allocated space for stack or pthread_internal_t.
 | 
					  // The main thread has no mmap allocated space for stack or pthread_internal_t.
 | 
				
			||||||
  main_thread.mmap_size = 0;
 | 
					  main_thread.mmap_size = 0;
 | 
				
			||||||
  pthread_attr_init(&main_thread.attr);
 | 
					  pthread_attr_init(&main_thread.attr);
 | 
				
			||||||
  main_thread.attr.flags = PTHREAD_ATTR_FLAG_MAIN_THREAD;
 | 
					 | 
				
			||||||
  main_thread.attr.guard_size = 0; // The main thread has no guard page.
 | 
					  main_thread.attr.guard_size = 0; // The main thread has no guard page.
 | 
				
			||||||
  main_thread.attr.stack_size = 0; // User code should never see this; we'll compute it when asked.
 | 
					  main_thread.attr.stack_size = 0; // User code should never see this; we'll compute it when asked.
 | 
				
			||||||
  // TODO: the main thread's sched_policy and sched_priority need to be queried.
 | 
					  // TODO: the main thread's sched_policy and sched_priority need to be queried.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -152,9 +152,6 @@ static int __pthread_attr_getstack_main_thread(void** stack_base, size_t* stack_
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pthread_attr_getstack(const pthread_attr_t* attr, void** stack_base, size_t* stack_size) {
 | 
					int pthread_attr_getstack(const pthread_attr_t* attr, void** stack_base, size_t* stack_size) {
 | 
				
			||||||
  if ((attr->flags & PTHREAD_ATTR_FLAG_MAIN_THREAD) != 0) {
 | 
					 | 
				
			||||||
    return __pthread_attr_getstack_main_thread(stack_base, stack_size);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  *stack_base = attr->stack_base;
 | 
					  *stack_base = attr->stack_base;
 | 
				
			||||||
  *stack_size = attr->stack_size;
 | 
					  *stack_size = attr->stack_size;
 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
@@ -171,7 +168,13 @@ int pthread_attr_getguardsize(const pthread_attr_t* attr, size_t* guard_size) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pthread_getattr_np(pthread_t t, pthread_attr_t* attr) {
 | 
					int pthread_getattr_np(pthread_t t, pthread_attr_t* attr) {
 | 
				
			||||||
  *attr = reinterpret_cast<pthread_internal_t*>(t)->attr;
 | 
					  pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(t);
 | 
				
			||||||
 | 
					  *attr = thread->attr;
 | 
				
			||||||
 | 
					  // The main thread's stack information is not stored in thread->attr, and we need to
 | 
				
			||||||
 | 
					  // collect that at runtime.
 | 
				
			||||||
 | 
					  if (thread->tid == getpid()) {
 | 
				
			||||||
 | 
					    return __pthread_attr_getstack_main_thread(&attr->stack_base, &attr->stack_size);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,9 +41,6 @@
 | 
				
			|||||||
/* Did the thread exit without freeing pthread_internal_t? */
 | 
					/* Did the thread exit without freeing pthread_internal_t? */
 | 
				
			||||||
#define PTHREAD_ATTR_FLAG_ZOMBIE 0x00000004
 | 
					#define PTHREAD_ATTR_FLAG_ZOMBIE 0x00000004
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Is this the main thread? */
 | 
					 | 
				
			||||||
#define PTHREAD_ATTR_FLAG_MAIN_THREAD 0x80000000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
struct pthread_key_data_t {
 | 
					struct pthread_key_data_t {
 | 
				
			||||||
  uintptr_t seq; // Use uintptr_t just for alignment, as we use pointer below.
 | 
					  uintptr_t seq; // Use uintptr_t just for alignment, as we use pointer below.
 | 
				
			||||||
  void* data;
 | 
					  void* data;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user