1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

Allow a single-threaded program to cancel itself

There is nothing in the POSIX specification to disallow a
single-threaded program from cancelling itself, so we forcibly enable
multiple_threads to allow the next available cancellation point in the
thread to run.

Also added additional tests to cover various cancellation scenarios.
This commit is contained in:
Siddhesh Poyarekar
2012-05-15 09:41:27 +05:30
parent 2949684c16
commit 439bf404b8
13 changed files with 300 additions and 11 deletions

View File

@@ -378,7 +378,9 @@ extern int *__libc_pthread_init (unsigned long int *ptr,
const struct pthread_functions *functions)
internal_function;
/* Variable set to a nonzero value if more than one thread runs or ran. */
/* Variable set to a nonzero value either if more than one thread runs or ran,
or if a single-threaded process is trying to cancel itself. See
nptl/descr.h for more context on the single-threaded process case. */
extern int __pthread_multiple_threads attribute_hidden;
/* Pointer to the corresponding variable in libc. */
extern int *__libc_multiple_threads_ptr attribute_hidden;