Add support for pthread_getattr_np#470
Conversation
| } else { | ||
| bounds.base = &__global_base; | ||
| bounds.size = (size_t)&__global_base; | ||
| } |
There was a problem hiding this comment.
This code only calculates the stack found of the main thread (i.e. the singular stack that the linker produces). Is that intended?
There was a problem hiding this comment.
This fills data for main thread, spawned threads have these fields filled in pthread_create.
| l += PAGE_SIZE; | ||
| a->_a_stacksize = l; | ||
| } | ||
| #else |
There was a problem hiding this comment.
Perhaps we can leave the if / else above and just replace the else block.
It looks like that if block covers secondary threads and the else block covers the main thread? We could use the __stack_high / __stack_low globals for the else case I think?
There was a problem hiding this comment.
The idea was to fill these fields in main thread struct and handle everything the same way. Otherwise this would need to duplicate the logic for getting stack bounds, fallback to __heap_base, etc...
There was a problem hiding this comment.
Replaced only else block.
|
@Milek7, can you rebase to fix the conflicts and then I can merge? |
Add pthread_getattr_np for getting stack bounds.