Skip to content

Commit 5aea520

Browse files
authored
Change pthread_create stub's error code (#716)
This changes from `EAGAIN` to `ENOTSUP` since this operation can't ever succeed, it's entirely unsupported. This is in relation to rust-lang/rust#151016 where in the Rust ecosystem crates were using the "Unsupported" error kind to gracefully handle errors from spawning a thread, such a falling back to single-threaded code. By switching to `EAGAIN` it caused these graceful fallbacks to not get triggered.
1 parent 60b2498 commit 5aea520

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

thread-stub/pthread_create.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ weak_alias(dummy_0, __release_ptc);
88

99
int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attrp, void *(*entry)(void *), void *restrict arg)
1010
{
11-
/*
12-
"The system lacked the necessary resources to create another thread,
13-
or the system-imposed limit on the total number of threads in a process
14-
{PTHREAD_THREADS_MAX} would be exceeded."
15-
*/
16-
return EAGAIN;
11+
return ENOTSUP;
1712
}
1813

1914
weak_alias(__pthread_create, pthread_create);

0 commit comments

Comments
 (0)