]> granicus.if.org Git - gc/commit
Fix deadlock (and double lock) in explicit thread suspend/resume
authorIvan Maidanski <ivmai@mail.ru>
Mon, 20 Jun 2016 08:38:50 +0000 (11:38 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 20 Jun 2016 08:38:50 +0000 (11:38 +0300)
commit59e2bcf96430d5ae4e307ac5d8323bf4ea679e47
tree524bbbc87fcdc527917fc4df9e596ca7a7fcd0ef
parent5327b21e518fd62254e33b135eb5e1d217f9fa77
Fix deadlock (and double lock) in explicit thread suspend/resume

* pthread_stop_world.c (GC_suspend_handler_inner)
[GC_ENABLE_SUSPEND_THREAD]: If SUSPENDED_EXT flag then set
stop_info.stack_ptr, call sem_post(suspend_ack_sem), and call
suspend_self_inner instead of GC_do_blocking(suspend_self_inner).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread):
No-op if already suspended; UNLOCK before GC_do_blocking (if
self-suspend); add TODO about GC_retry_signals; clear SUSPENDED_EXT
flag if RAISE_SIGNAL failed with ESRCH code; sem_wait(suspend_ack_sem)
to let the suspend handler to lookup the thread and store stack_ptr
(and save registers if needed).
* pthread_stop_world.c (GC_suspend_all, GC_start_world): Skip threads
with SUSPENDED_EXT flag.
pthread_stop_world.c