Skip to content

Commit

Permalink
Do Parrot_thread_kill_all before Parrot_runcore_destroy
Browse files Browse the repository at this point in the history
Change Parrot_thread_destroy_all(interp) to Parrot_thread_destroy_all(NULL)
No interp needed for the interp's in the global threads_array.
  • Loading branch information
Reini Urban committed Sep 18, 2012
1 parent 2bae6d7 commit 42bb405
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
7 changes: 2 additions & 5 deletions include/parrot/thread.h
Expand Up @@ -149,9 +149,7 @@ PMC* Parrot_thread_create_proxy(PARROT_INTERP,
__attribute__nonnull__(2)
__attribute__nonnull__(3);

void Parrot_thread_destroy_all(PARROT_INTERP)
__attribute__nonnull__(1);

void Parrot_thread_destroy_all(PARROT_INTERP);
int Parrot_thread_get_free_threads_array_index(PARROT_INTERP);
PARROT_CANNOT_RETURN_NULL
Interp** Parrot_thread_get_threads_array(PARROT_INTERP);
Expand Down Expand Up @@ -230,8 +228,7 @@ void Parrot_thread_wait_for_notification(PARROT_INTERP)
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(thread) \
, PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_thread_destroy_all __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_thread_destroy_all __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_thread_get_free_threads_array_index \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_thread_get_threads_array \
Expand Down
10 changes: 5 additions & 5 deletions src/interp/api.c
Expand Up @@ -429,14 +429,14 @@ Parrot_interp_really_destroy(PARROT_INTERP, int exit_code, SHIM(void *arg))
/* Now the PIOData gets also cleared */
Parrot_io_finish(interp);

/* deinit runcores and dynamic op_libs */
if (!interp->parent_interpreter)
Parrot_runcore_destroy(interp);

#ifdef PARROT_HAS_THREADS
Parrot_thread_kill_all(interp);
#endif

/* deinit runcores and dynamic op_libs */
if (!interp->parent_interpreter)
Parrot_runcore_destroy(interp);

/*
* now all objects that need timely destruction should be finalized
* so terminate the event loop
Expand All @@ -459,7 +459,7 @@ Parrot_interp_really_destroy(PARROT_INTERP, int exit_code, SHIM(void *arg))
Parrot_gc_destroy_child_interp(interp->parent_interpreter, interp);

#ifdef PARROT_HAS_THREADS
Parrot_thread_destroy_all(interp);
Parrot_thread_destroy_all(NULL);
#endif

Parrot_gc_mark_and_sweep(interp, GC_finish_FLAG);
Expand Down
7 changes: 4 additions & 3 deletions src/thread.c
Expand Up @@ -746,15 +746,16 @@ Parrot_thread_kill_all(PARROT_INTERP)
=item C<void Parrot_thread_destroy_all(PARROT_INTERP)>
Cancel all already killed threads, destroy all thread
interpreters and free the threads_array.
Cancel all already killed threads, destroy all
remaining thread interpreters and free the
threads_array.
=cut
*/

void
Parrot_thread_destroy_all(PARROT_INTERP)
Parrot_thread_destroy_all(SHIM_INTERP)
{
ASSERT_ARGS(Parrot_thread_destroy_all)

Expand Down

0 comments on commit 42bb405

Please sign in to comment.