8000 miscellaneous fixes by mrwicked · Pull Request #32 · tinycthread/tinycthread · GitHub
[go: up one dir, main page]

Skip to content

Conversation

mrwicked
Copy link
Contributor
  • added option to set the initial size of the stack
  • not all POSIX implementations create threads as joinable by default
  • windows thread handles 'cannot' be compared; because for ex.
    GetCurrentThread() returns a pseudo handle

added option to set the initial size of the stack
not all POSIX implementations create threads as joinable by default
windows thread handles 'cannot' be compared by HANDLE; because for ex.
GetCurrentThread() returns a pseudo handle
@mrwicked mrwicked changed the title thrd_create additions miscellaneous fixes Feb 27, 2016
@nemequ
Copy link
Contributor
nemequ commented Feb 27, 2016

Thanks!

I know stack size can be an issue on Windows (on Linux the stack will grow automatically as needed), but changing the thrd_create API is not an option. That API is defined in § 7.26.5.1 of the C11 specification. There are ways to set the default stack size at compile time, I think you'll have to do that instead.

e1fba13 (the thrd_equal thing) looks good.

Making sure the threads are joinable is a good idea, but the error handling needs improvement; if pthread_attr_init is successful then pthread_attr_destroy must be called, regardless of whether pthread_attr_setdetach_state and pthread_create (and potentially pthread_attr_setstacksize, though I think that will have to be removed) succeed.

@nemequ
Copy link
Contributor
nemequ commented Feb 28, 2016

Cherry-picked e1fba13 (as 53eb563).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0