◐ Shell
clean mode source ↗

bpo-33015: Add a wrapper for thread function in PyThread_start_new_thread by siddhesh · Pull Request #6008 · python/cpython

izbyshev

izbyshev

izbyshev

vstinner

pitrou

vstinner

PyThread_start_new_thread accepts a function of type void (*) (void
*), which does not match with the pthread_create function callback
prototype void *(*) (void *).  This is undefined behaviour and hence
results in an invalid function cast warning with gcc8.  Fix this by
wrapping the function in an internal pthread function callback that
returns NULL.
* Rename pythread_fn to pythread_callback
* Rename pythread_helper_fn() to pythread_wrapper()
* Rewrite the comment
* Rename "fn" to "callback"
* Add { ... } to if
* Remove useless cast

vstinner

@vstinner

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Nov 30, 2018
Fix an undefined behaviour in the pthread implementation of
PyThread_start_new_thread(): add a function wrapper to always return
NULL.

Add pythread_callback struct and pythread_wrapper() to thread_pthread.h.
(cherry picked from commit 9eea6ea)

Co-authored-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>

miss-islington added a commit that referenced this pull request

Nov 30, 2018
Fix an undefined behaviour in the pthread implementation of
PyThread_start_new_thread(): add a function wrapper to always return
NULL.

Add pythread_callback struct and pythread_wrapper() to thread_pthread.h.
(cherry picked from commit 9eea6ea)

Co-authored-by: Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com>

vstinner added a commit that referenced this pull request

Nov 30, 2018
…10822)

Fix an undefined behaviour in the pthread implementation of
PyThread_start_new_thread(): add a function wrapper to always return
NULL.

Add pythread_callback struct and pythread_wrapper() to thread_pthread.h.

(cherry picked from commit 9eea6ea)

vstinner added a commit that referenced this pull request

Nov 30, 2018
…10823)

Fix an undefined behaviour in the pthread implementation of
PyThread_start_new_thread(): add a function wrapper to always return
NULL.

Add pythread_callback struct and pythread_wrapper() to thread_pthread.h.

(cherry picked from commit 9eea6ea)