/* threading.c generated by valac 0.16.1, the Vala compiler
 * generated from threading.vala, do not modify */

/*
 * Copyright (C) 2009-2012 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 **/

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <gobject/gvaluecollector.h>


#define FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD (fso_framework_threading_dummy_thread_get_type ())
#define FSO_FRAMEWORK_THREADING_DUMMY_THREAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD, FsoFrameworkThreadingDummyThread))
#define FSO_FRAMEWORK_THREADING_DUMMY_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD, FsoFrameworkThreadingDummyThreadClass))
#define FSO_FRAMEWORK_THREADING_IS_DUMMY_THREAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD))
#define FSO_FRAMEWORK_THREADING_IS_DUMMY_THREAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD))
#define FSO_FRAMEWORK_THREADING_DUMMY_THREAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD, FsoFrameworkThreadingDummyThreadClass))

typedef struct _FsoFrameworkThreadingDummyThread FsoFrameworkThreadingDummyThread;
typedef struct _FsoFrameworkThreadingDummyThreadClass FsoFrameworkThreadingDummyThreadClass;
typedef struct _FsoFrameworkThreadingDummyThreadPrivate FsoFrameworkThreadingDummyThreadPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _FsoFrameworkThreadingParamSpecDummyThread FsoFrameworkThreadingParamSpecDummyThread;
typedef struct _Block3Data Block3Data;
#define _g_cond_free0(var) ((var == NULL) ? NULL : (var = (g_cond_free (var), NULL)))
#define _g_mutex_free0(var) ((var == NULL) ? NULL : (var = (g_mutex_free (var), NULL)))

typedef void (*FsoFrameworkThreadingVoidFuncWithVoidStarParam) (void* param, void* user_data);
struct _FsoFrameworkThreadingDummyThread {
	GTypeInstance parent_instance;
	volatile int ref_count;
	FsoFrameworkThreadingDummyThreadPrivate * priv;
	FsoFrameworkThreadingDummyThread* pself;
};

struct _FsoFrameworkThreadingDummyThreadClass {
	GTypeClass parent_class;
	void (*finalize) (FsoFrameworkThreadingDummyThread *self);
};

struct _FsoFrameworkThreadingDummyThreadPrivate {
	FsoFrameworkThreadingVoidFuncWithVoidStarParam func;
	gpointer func_target;
	GDestroyNotify func_target_destroy_notify;
	void* param;
};

struct _FsoFrameworkThreadingParamSpecDummyThread {
	GParamSpec parent_instance;
};

struct _Block3Data {
	int _ref_count_;
	GCond* cond;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam func;
	gpointer func_target;
	void* param;
};


static gpointer fso_framework_threading_dummy_thread_parent_class = NULL;

gpointer fso_framework_threading_dummy_thread_ref (gpointer instance);
void fso_framework_threading_dummy_thread_unref (gpointer instance);
GParamSpec* fso_framework_threading_param_spec_dummy_thread (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void fso_framework_threading_value_set_dummy_thread (GValue* value, gpointer v_object);
void fso_framework_threading_value_take_dummy_thread (GValue* value, gpointer v_object);
gpointer fso_framework_threading_value_get_dummy_thread (const GValue* value);
GType fso_framework_threading_dummy_thread_get_type (void) G_GNUC_CONST;
#define FSO_FRAMEWORK_THREADING_DUMMY_THREAD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD, FsoFrameworkThreadingDummyThreadPrivate))
enum  {
	FSO_FRAMEWORK_THREADING_DUMMY_THREAD_DUMMY_PROPERTY
};
FsoFrameworkThreadingDummyThread* fso_framework_threading_dummy_thread_new (FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, void* param);
FsoFrameworkThreadingDummyThread* fso_framework_threading_dummy_thread_construct (GType object_type, FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, void* param);
void fso_framework_threading_dummy_thread_launch (FsoFrameworkThreadingDummyThread* self, FsoFrameworkThreadingDummyThread* pself);
void* fso_framework_threading_dummy_thread_main (FsoFrameworkThreadingDummyThread* self);
static gpointer _fso_framework_threading_dummy_thread_main_gthread_func (gpointer self);
static void fso_framework_threading_dummy_thread_finalize (FsoFrameworkThreadingDummyThread* obj);
gboolean fso_framework_threading_isMainThread (void);
void fso_framework_threading_callDelegateOnMainThread (FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, gboolean waitForCompletion, void* param);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static gboolean ____lambda5_ (Block3Data* _data3_);
static gboolean _____lambda5__gsource_func (gpointer self);
static gboolean ____lambda6_ (Block3Data* _data3_);
static gboolean _____lambda6__gsource_func (gpointer self);
static gboolean ____lambda7_ (Block3Data* _data3_);
static gboolean _____lambda7__gsource_func (gpointer self);
void fso_framework_threading_callDelegateOnNewThread (FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, void* param);


FsoFrameworkThreadingDummyThread* fso_framework_threading_dummy_thread_construct (GType object_type, FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, void* param) {
	FsoFrameworkThreadingDummyThread* self = NULL;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp0_;
	void* _tmp0__target;
	void* _tmp1_;
	self = (FsoFrameworkThreadingDummyThread*) g_type_create_instance (object_type);
	_tmp0_ = func;
	_tmp0__target = func_target;
	(self->priv->func_target_destroy_notify == NULL) ? NULL : (self->priv->func_target_destroy_notify (self->priv->func_target), NULL);
	self->priv->func = NULL;
	self->priv->func_target = NULL;
	self->priv->func_target_destroy_notify = NULL;
	self->priv->func = _tmp0_;
	self->priv->func_target = _tmp0__target;
	self->priv->func_target_destroy_notify = NULL;
	_tmp1_ = param;
	self->priv->param = _tmp1_;
	return self;
}


FsoFrameworkThreadingDummyThread* fso_framework_threading_dummy_thread_new (FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, void* param) {
	return fso_framework_threading_dummy_thread_construct (FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD, func, func_target, param);
}


static gpointer _fso_framework_threading_dummy_thread_main_gthread_func (gpointer self) {
	gpointer result;
	result = fso_framework_threading_dummy_thread_main (self);
	return result;
}


static const gchar* string_to_string (const gchar* self) {
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}


void fso_framework_threading_dummy_thread_launch (FsoFrameworkThreadingDummyThread* self, FsoFrameworkThreadingDummyThread* pself) {
	FsoFrameworkThreadingDummyThread* _tmp0_;
	FsoFrameworkThreadingDummyThread* _tmp1_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = pself;
	g_assert (_tmp0_ != NULL);
	_tmp1_ = pself;
	self->pself = _tmp1_;
	{
		g_thread_create (_fso_framework_threading_dummy_thread_main_gthread_func, self, FALSE, &_inner_error_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_THREAD_ERROR) {
				goto __catch16_g_thread_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	goto __finally16;
	__catch16_g_thread_error:
	{
		GError* e = NULL;
		const gchar* _tmp2_;
		const gchar* _tmp3_ = NULL;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp2_ = e->message;
		_tmp3_ = string_to_string (_tmp2_);
		_tmp4_ = g_strconcat ("Can't spawn thread: ", _tmp3_, NULL);
		_tmp5_ = _tmp4_;
		g_error ("threading.vala:49: %s", _tmp5_);
		_g_free0 (_tmp5_);
		_g_error_free0 (e);
	}
	__finally16:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


void* fso_framework_threading_dummy_thread_main (FsoFrameworkThreadingDummyThread* self) {
	void* result = NULL;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp0_;
	void* _tmp0__target;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp1_;
	void* _tmp1__target;
	void* _tmp2_;
	FsoFrameworkThreadingDummyThread* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	g_assert (self != NULL);
	_tmp0_ = self->priv->func;
	_tmp0__target = self->priv->func_target;
	g_assert (_tmp0_ != NULL);
	_tmp1_ = self->priv->func;
	_tmp1__target = self->priv->func_target;
	_tmp2_ = self->priv->param;
	_tmp1_ (_tmp2_, _tmp1__target);
	_tmp3_ = self->pself;
	fso_framework_threading_dummy_thread_unref (_tmp3_);
	result = NULL;
	return result;
}


static void fso_framework_threading_value_dummy_thread_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void fso_framework_threading_value_dummy_thread_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		fso_framework_threading_dummy_thread_unref (value->data[0].v_pointer);
	}
}


static void fso_framework_threading_value_dummy_thread_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = fso_framework_threading_dummy_thread_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer fso_framework_threading_value_dummy_thread_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* fso_framework_threading_value_dummy_thread_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		FsoFrameworkThreadingDummyThread* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = fso_framework_threading_dummy_thread_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* fso_framework_threading_value_dummy_thread_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	FsoFrameworkThreadingDummyThread** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = fso_framework_threading_dummy_thread_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* fso_framework_threading_param_spec_dummy_thread (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	FsoFrameworkThreadingParamSpecDummyThread* spec;
	g_return_val_if_fail (g_type_is_a (object_type, FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer fso_framework_threading_value_get_dummy_thread (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD), NULL);
	return value->data[0].v_pointer;
}


void fso_framework_threading_value_set_dummy_thread (GValue* value, gpointer v_object) {
	FsoFrameworkThreadingDummyThread* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		fso_framework_threading_dummy_thread_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		fso_framework_threading_dummy_thread_unref (old);
	}
}


void fso_framework_threading_value_take_dummy_thread (GValue* value, gpointer v_object) {
	FsoFrameworkThreadingDummyThread* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FSO_FRAMEWORK_THREADING_TYPE_DUMMY_THREAD));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		fso_framework_threading_dummy_thread_unref (old);
	}
}


static void fso_framework_threading_dummy_thread_class_init (FsoFrameworkThreadingDummyThreadClass * klass) {
	fso_framework_threading_dummy_thread_parent_class = g_type_class_peek_parent (klass);
	FSO_FRAMEWORK_THREADING_DUMMY_THREAD_CLASS (klass)->finalize = fso_framework_threading_dummy_thread_finalize;
	g_type_class_add_private (klass, sizeof (FsoFrameworkThreadingDummyThreadPrivate));
}


static void fso_framework_threading_dummy_thread_instance_init (FsoFrameworkThreadingDummyThread * self) {
	self->priv = FSO_FRAMEWORK_THREADING_DUMMY_THREAD_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void fso_framework_threading_dummy_thread_finalize (FsoFrameworkThreadingDummyThread* obj) {
	FsoFrameworkThreadingDummyThread * self;
	self = FSO_FRAMEWORK_THREADING_DUMMY_THREAD (obj);
	(self->priv->func_target_destroy_notify == NULL) ? NULL : (self->priv->func_target_destroy_notify (self->priv->func_target), NULL);
	self->priv->func = NULL;
	self->priv->func_target = NULL;
	self->priv->func_target_destroy_notify = NULL;
}


GType fso_framework_threading_dummy_thread_get_type (void) {
	static volatile gsize fso_framework_threading_dummy_thread_type_id__volatile = 0;
	if (g_once_init_enter (&fso_framework_threading_dummy_thread_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { fso_framework_threading_value_dummy_thread_init, fso_framework_threading_value_dummy_thread_free_value, fso_framework_threading_value_dummy_thread_copy_value, fso_framework_threading_value_dummy_thread_peek_pointer, "p", fso_framework_threading_value_dummy_thread_collect_value, "p", fso_framework_threading_value_dummy_thread_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (FsoFrameworkThreadingDummyThreadClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fso_framework_threading_dummy_thread_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FsoFrameworkThreadingDummyThread), 0, (GInstanceInitFunc) fso_framework_threading_dummy_thread_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType fso_framework_threading_dummy_thread_type_id;
		fso_framework_threading_dummy_thread_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FsoFrameworkThreadingDummyThread", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&fso_framework_threading_dummy_thread_type_id__volatile, fso_framework_threading_dummy_thread_type_id);
	}
	return fso_framework_threading_dummy_thread_type_id__volatile;
}


gpointer fso_framework_threading_dummy_thread_ref (gpointer instance) {
	FsoFrameworkThreadingDummyThread* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void fso_framework_threading_dummy_thread_unref (gpointer instance) {
	FsoFrameworkThreadingDummyThread* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		FSO_FRAMEWORK_THREADING_DUMMY_THREAD_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static pid_t gettid (void) {
	pid_t result = 0;
	gint _tmp0_ = 0;
	_tmp0_ = syscall ((gint) SYS_gettid, NULL);
	result = (pid_t) _tmp0_;
	return result;
}


gboolean fso_framework_threading_isMainThread (void) {
	gboolean result = FALSE;
	pid_t _tmp0_ = 0;
	pid_t _tmp1_ = 0;
	_tmp0_ = gettid ();
	_tmp1_ = getpid ();
	result = _tmp0_ == _tmp1_;
	return result;
}


static Block3Data* block3_data_ref (Block3Data* _data3_) {
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}


static void block3_data_unref (void * _userdata_) {
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		_g_cond_free0 (_data3_->cond);
		g_slice_free (Block3Data, _data3_);
	}
}


static gboolean ____lambda5_ (Block3Data* _data3_) {
	gboolean result = FALSE;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp0_;
	void* _tmp0__target;
	void* _tmp1_;
	_tmp0_ = _data3_->func;
	_tmp0__target = _data3_->func_target;
	_tmp1_ = _data3_->param;
	_tmp0_ (_tmp1_, _tmp0__target);
	result = FALSE;
	return result;
}


static gboolean _____lambda5__gsource_func (gpointer self) {
	gboolean result;
	result = ____lambda5_ (self);
	return result;
}


static gboolean ____lambda6_ (Block3Data* _data3_) {
	gboolean result = FALSE;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp0_;
	void* _tmp0__target;
	void* _tmp1_;
	GCond* _tmp2_;
	_tmp0_ = _data3_->func;
	_tmp0__target = _data3_->func_target;
	_tmp1_ = _data3_->param;
	_tmp0_ (_tmp1_, _tmp0__target);
	_tmp2_ = _data3_->cond;
	g_cond_broadcast (_tmp2_);
	result = FALSE;
	return result;
}


static gboolean _____lambda6__gsource_func (gpointer self) {
	gboolean result;
	result = ____lambda6_ (self);
	return result;
}


static gboolean ____lambda7_ (Block3Data* _data3_) {
	gboolean result = FALSE;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp0_;
	void* _tmp0__target;
	void* _tmp1_;
	_tmp0_ = _data3_->func;
	_tmp0__target = _data3_->func_target;
	_tmp1_ = _data3_->param;
	_tmp0_ (_tmp1_, _tmp0__target);
	result = FALSE;
	return result;
}


static gboolean _____lambda7__gsource_func (gpointer self) {
	gboolean result;
	result = ____lambda7_ (self);
	return result;
}


void fso_framework_threading_callDelegateOnMainThread (FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, gboolean waitForCompletion, void* param) {
	Block3Data* _data3_;
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp0_;
	void* _tmp0__target;
	void* _tmp1_;
	GMutex* _tmp2_;
	GMutex* mutex;
	GCond* _tmp3_;
	gboolean _tmp4_ = FALSE;
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_tmp0_ = func;
	_tmp0__target = func_target;
	_data3_->func = _tmp0_;
	_data3_->func_target = _tmp0__target;
	_tmp1_ = param;
	_data3_->param = _tmp1_;
	_tmp2_ = g_mutex_new ();
	mutex = _tmp2_;
	_tmp3_ = g_cond_new ();
	_data3_->cond = _tmp3_;
	_tmp4_ = fso_framework_threading_isMainThread ();
	if (_tmp4_) {
		gboolean _tmp5_;
		_tmp5_ = waitForCompletion;
		if (_tmp5_) {
			FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp6_;
			void* _tmp6__target;
			void* _tmp7_;
			_tmp6_ = _data3_->func;
			_tmp6__target = _data3_->func_target;
			_tmp7_ = _data3_->param;
			_tmp6_ (_tmp7_, _tmp6__target);
		} else {
			g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _____lambda5__gsource_func, block3_data_ref (_data3_), block3_data_unref);
		}
	} else {
		gboolean _tmp8_;
		_tmp8_ = waitForCompletion;
		if (_tmp8_) {
			GCond* _tmp9_;
			GMutex* _tmp10_;
			g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _____lambda6__gsource_func, block3_data_ref (_data3_), block3_data_unref);
			_tmp9_ = _data3_->cond;
			_tmp10_ = mutex;
			g_cond_wait (_tmp9_, _tmp10_);
		} else {
			g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _____lambda7__gsource_func, block3_data_ref (_data3_), block3_data_unref);
		}
	}
	_g_mutex_free0 (mutex);
	block3_data_unref (_data3_);
	_data3_ = NULL;
}


void fso_framework_threading_callDelegateOnNewThread (FsoFrameworkThreadingVoidFuncWithVoidStarParam func, void* func_target, void* param) {
	FsoFrameworkThreadingVoidFuncWithVoidStarParam _tmp0_;
	void* _tmp0__target;
	void* _tmp1_;
	FsoFrameworkThreadingDummyThread* _tmp2_;
	FsoFrameworkThreadingDummyThread* thread;
	_tmp0_ = func;
	_tmp0__target = func_target;
	_tmp1_ = param;
	_tmp2_ = fso_framework_threading_dummy_thread_new (_tmp0_, _tmp0__target, _tmp1_);
	thread = _tmp2_;
	fso_framework_threading_dummy_thread_launch (thread, thread);
}



