fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / src / pmc / threadinterpreter.pmc
blobcb5ebf0908b796961013cb0ac3329bac992c9731
1 /*
2 Copyright (C) 2001-2007, Parrot Foundation.
3 $Id$
5 =head1 NAME
7 src/pmc/threadinterpreter.pmc - INTERNAL Interpreter for OS level worker thread(pthread).
9 =head1 DESCRIPTION
11 ThreadInterpreter extends ParrotInterpreter to provide a interpreter
12 to be used internally in a OS level worker thread(pthread).
13 which supports:
15 =head2 Methods
17 =over 4
19 =cut
23 #include "parrot/embed.h"
25 /* HEADERIZER HFILE: none */
26 /* HEADERIZER BEGIN: static */
27 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
29 static void stop_GC(ARGMOD(Interp *parent), ARGMOD(Interp *thread))
30         __attribute__nonnull__(1)
31         __attribute__nonnull__(2)
32         FUNC_MODIFIES(*parent)
33         FUNC_MODIFIES(*thread);
35 #define ASSERT_ARGS_stop_GC __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
36        PARROT_ASSERT_ARG(parent) \
37     , PARROT_ASSERT_ARG(thread))
38 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
39 /* HEADERIZER END: static */
41 #define PMC_interp(x) ((Parrot_ParrotInterpreter_attributes *)PMC_data(x))->interp
44  * can't do multi-threaded GC yet
45  * XXX a quick hack to pass the few tests
46  */
50 =item C<static void stop_GC(Interp *parent, Interp *thread)>
52 =cut
56 static void
57 stop_GC(ARGMOD(Interp *parent), ARGMOD(Interp *thread))
59     ASSERT_ARGS(stop_GC)
60     Parrot_block_GC_mark(parent);
61     Parrot_block_GC_mark(thread);
62     Parrot_block_GC_sweep(parent);
63     Parrot_block_GC_sweep(thread);
68 pmclass ThreadInterpreter extends ParrotInterpreter no_ro manual_attrs {
72 =item C<void init()>
74 Initializes the thread.
76 =cut
80     VTABLE void init() {
81         /* protect interpreter creation and list handling */
82         LOCK(interpreter_array_mutex);
84         SUPER();
85         pt_add_to_interpreters(INTERP, PMC_interp(SELF));
87         UNLOCK(interpreter_array_mutex);
89         /* can't allow GC runs for now */
90         stop_GC(INTERP, PMC_interp(SELF));
91     }
96 =back
98 =cut
103  * Local variables:
104  *   c-file-style: "parrot"
105  * End:
106  * vim: expandtab shiftwidth=4:
107  */