+2007-07-10 Jürg Billeter <j@bitron.ch>
+
+ * vala/valacodecontext.vala, gobject/valaccodecompiler.vala,
+ gobject/valacodegeneratormethod.vala, compiler/valacompiler.vala:
+ add --thread option to enable multithreading support
+
2007-07-10 Jürg Billeter <j@bitron.ch>
* gobject/valaccodecompiler.vala: always use gobject-2.0
static bool compile_only;
static string output;
static bool debug;
+ static bool thread;
static int optlevel;
static bool disable_assert;
static bool enable_checking;
{ "compile", 'c', 0, OptionArg.NONE, ref compile_only, "Compile but do not link", null },
{ "output", 'o', 0, OptionArg.FILENAME, out output, "Place output in file FILE", "FILE" },
{ "debug", 'g', 0, OptionArg.NONE, ref debug, "Produce debug information", null },
+ { "thread", 0, 0, OptionArg.NONE, ref thread, "Enable multithreading support", null },
{ "optimize", 'O', 0, OptionArg.INT, ref optlevel, "Optimization level", "OPTLEVEL" },
{ "disable-assert", 0, 0, OptionArg.NONE, ref disable_assert, "Disable assertions", null },
{ "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable run-time checks", null },
context.compile_only = compile_only;
context.output = output;
context.debug = debug;
+ context.thread = thread;
context.optlevel = optlevel;
/* default package */
cmain.add_parameter (new CCodeFormalParameter ("argc", "int"));
cmain.add_parameter (new CCodeFormalParameter ("argv", "char **"));
var main_block = new CCodeBlock ();
+
+ if (context.thread) {
+ var thread_init_call = new CCodeFunctionCall (new CCodeIdentifier ("g_thread_init"));
+ thread_init_call.add_argument (new CCodeConstant ("NULL"));
+ main_block.add_statement (new CCodeExpressionStatement (thread_init_call));
+ }
+
main_block.add_statement (new CCodeExpressionStatement (new CCodeFunctionCall (new CCodeIdentifier ("g_type_init"))));
var main_call = new CCodeFunctionCall (new CCodeIdentifier (function.name));
if (args_parameter) {