/* zipfuture.c generated by valac 0.20.1.52-2186, the Vala compiler
 * generated from zipfuture.vala, do not modify */

/* zipfuture.vala
 *
 * Copyright (C) 2013  Maciej Piechotka
 *
 * 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
 *
 * Author:
 * 	Maciej Piechotka <uzytkownik2@gmail.com>
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <string.h>


#define GEE_TYPE_FUTURE (gee_future_get_type ())
#define GEE_FUTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_FUTURE, GeeFuture))
#define GEE_IS_FUTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_FUTURE))
#define GEE_FUTURE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_FUTURE, GeeFutureIface))

typedef struct _GeeFuture GeeFuture;
typedef struct _GeeFutureIface GeeFutureIface;

#define GEE_TYPE_ZIP_FUTURE (gee_zip_future_get_type ())
#define GEE_ZIP_FUTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_ZIP_FUTURE, GeeZipFuture))
#define GEE_ZIP_FUTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_ZIP_FUTURE, GeeZipFutureClass))
#define GEE_IS_ZIP_FUTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_ZIP_FUTURE))
#define GEE_IS_ZIP_FUTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_ZIP_FUTURE))
#define GEE_ZIP_FUTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_ZIP_FUTURE, GeeZipFutureClass))

typedef struct _GeeZipFuture GeeZipFuture;
typedef struct _GeeZipFutureClass GeeZipFutureClass;
typedef struct _GeeZipFuturePrivate GeeZipFuturePrivate;

#define GEE_FUTURE_TYPE_WHEN_DONE_ARRAY_ELEMENT (gee_future_when_done_array_element_get_type ())
typedef struct _GeeFutureWhenDoneArrayElement GeeFutureWhenDoneArrayElement;

#define GEE_ZIP_FUTURE_TYPE_PROGRESS (gee_zip_future_progress_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block20Data Block20Data;
typedef struct _Block21Data Block21Data;
typedef struct _GeeZipFutureWaitAsyncData GeeZipFutureWaitAsyncData;

typedef void (*GeeFutureWhenDoneFunc) (gconstpointer value, void* user_data);
typedef gpointer (*GeeFutureMapFunc) (gconstpointer value, void* user_data);
typedef gconstpointer (*GeeFutureLightMapFunc) (gconstpointer value, void* user_data);
typedef gpointer (*GeeFutureZipFunc) (gconstpointer a, gconstpointer b, void* user_data);
typedef GeeFuture* (*GeeFutureFlatMapFunc) (gconstpointer value, void* user_data);
struct _GeeFutureIface {
	GTypeInterface parent_iface;
	GType (*get_g_type) (GeeFuture* self);
	GBoxedCopyFunc (*get_g_dup_func) (GeeFuture* self);
	GDestroyNotify (*get_g_destroy_func) (GeeFuture* self);
	gconstpointer (*wait) (GeeFuture* self);
	gboolean (*wait_until) (GeeFuture* self, gint64 end_time, gconstpointer* value);
	void (*wait_async) (GeeFuture* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gconstpointer (*wait_finish) (GeeFuture* self, GAsyncResult* _res_);
	void (*when_done) (GeeFuture* self, GeeFutureWhenDoneFunc func, void* func_target);
	GeeFuture* (*map) (GeeFuture* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFutureMapFunc func, void* func_target);
	GeeFuture* (*light_map) (GeeFuture* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFutureLightMapFunc func, void* func_target);
	GeeFuture* (*zip) (GeeFuture* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GeeFutureZipFunc zip_func, void* zip_func_target, GeeFuture* second);
	GeeFuture* (*flat_map) (GeeFuture* self, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GeeFutureFlatMapFunc func, void* func_target);
	gconstpointer (*get_value) (GeeFuture* self);
	gboolean (*get_ready) (GeeFuture* self);
};

struct _GeeZipFuture {
	GObject parent_instance;
	GeeZipFuturePrivate * priv;
};

struct _GeeZipFutureClass {
	GObjectClass parent_class;
};

struct _GeeFutureWhenDoneArrayElement {
	GeeFutureWhenDoneFunc func;
	gpointer func_target;
	GDestroyNotify func_target_destroy_notify;
};

typedef enum  {
	GEE_ZIP_FUTURE_PROGRESS_INIT,
	GEE_ZIP_FUTURE_PROGRESS_PROGRESS,
	GEE_ZIP_FUTURE_PROGRESS_READY
} GeeZipFutureProgress;

struct _GeeZipFuturePrivate {
	GType a_type;
	GBoxedCopyFunc a_dup_func;
	GDestroyNotify a_destroy_func;
	GType b_type;
	GBoxedCopyFunc b_dup_func;
	GDestroyNotify b_destroy_func;
	GType c_type;
	GBoxedCopyFunc c_dup_func;
	GDestroyNotify c_destroy_func;
	GMutex _mutex;
	GCond _cond;
	GeeFuture* _left;
	GeeFuture* _right;
	GeeFutureZipFunc _func;
	gpointer _func_target;
	GDestroyNotify _func_target_destroy_notify;
	gpointer _value;
	GeeFutureWhenDoneArrayElement* _when_done;
	gint _when_done_length1;
	gint __when_done_size_;
	GeeZipFutureProgress _progress;
};

struct _Block20Data {
	int _ref_count_;
	GeeZipFuture * self;
	gpointer l;
};

struct _Block21Data {
	int _ref_count_;
	GeeZipFuture * self;
	gpointer _async_data_;
};

struct _GeeZipFutureWaitAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	GeeZipFuture* self;
	gconstpointer result;
	Block21Data* _data21_;
	GeeZipFutureProgress progress;
	GeeZipFutureProgress _tmp0_;
	GeeZipFutureProgress _tmp1_;
	GeeFuture* left;
	GeeFuture* _tmp2_;
	GeeFuture* _tmp3_;
	GeeFuture* right;
	GeeFuture* _tmp4_;
	GeeFuture* _tmp5_;
	GeeFuture* _tmp6_;
	GeeFuture* _tmp7_;
	GeeZipFutureProgress _tmp8_;
	gconstpointer _result_;
	GeeFutureWhenDoneArrayElement* _tmp9_;
	gint _tmp9__length1;
	GeeFutureWhenDoneArrayElement _tmp10_;
	gconstpointer _tmp11_;
	GeeZipFutureProgress _tmp12_;
	gconstpointer _tmp13_;
};


static gpointer gee_zip_future_parent_class = NULL;
static GeeFutureIface* gee_zip_future_gee_future_parent_iface = NULL;

GType gee_future_get_type (void) G_GNUC_CONST;
GType gee_zip_future_get_type (void) G_GNUC_CONST;
GType gee_future_when_done_array_element_get_type (void) G_GNUC_CONST;
GeeFutureWhenDoneArrayElement* gee_future_when_done_array_element_dup (const GeeFutureWhenDoneArrayElement* self);
void gee_future_when_done_array_element_free (GeeFutureWhenDoneArrayElement* self);
void gee_future_when_done_array_element_copy (const GeeFutureWhenDoneArrayElement* self, GeeFutureWhenDoneArrayElement* dest);
void gee_future_when_done_array_element_destroy (GeeFutureWhenDoneArrayElement* self);
static GType gee_zip_future_progress_get_type (void) G_GNUC_UNUSED;
#define GEE_ZIP_FUTURE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_ZIP_FUTURE, GeeZipFuturePrivate))
enum  {
	GEE_ZIP_FUTURE_DUMMY_PROPERTY,
	GEE_ZIP_FUTURE_A_TYPE,
	GEE_ZIP_FUTURE_A_DUP_FUNC,
	GEE_ZIP_FUTURE_A_DESTROY_FUNC,
	GEE_ZIP_FUTURE_B_TYPE,
	GEE_ZIP_FUTURE_B_DUP_FUNC,
	GEE_ZIP_FUTURE_B_DESTROY_FUNC,
	GEE_ZIP_FUTURE_C_TYPE,
	GEE_ZIP_FUTURE_C_DUP_FUNC,
	GEE_ZIP_FUTURE_C_DESTROY_FUNC,
	GEE_ZIP_FUTURE_READY
};
static void _vala_GeeFutureWhenDoneArrayElement_array_free (GeeFutureWhenDoneArrayElement* array, gint array_length);
GeeZipFuture* gee_zip_future_new (GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GType c_type, GBoxedCopyFunc c_dup_func, GDestroyNotify c_destroy_func, GeeFutureZipFunc func, void* func_target, GeeFuture* left, GeeFuture* right);
GeeZipFuture* gee_zip_future_construct (GType object_type, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GType c_type, GBoxedCopyFunc c_dup_func, GDestroyNotify c_destroy_func, GeeFutureZipFunc func, void* func_target, GeeFuture* left, GeeFuture* right);
void gee_future_when_done (GeeFuture* self, GeeFutureWhenDoneFunc func, void* func_target);
static void __lambda43_ (GeeZipFuture* self, gconstpointer l);
static Block20Data* block20_data_ref (Block20Data* _data20_);
static void block20_data_unref (void * _userdata_);
static void __lambda44_ (Block20Data* _data20_, gconstpointer r);
static inline gconstpointer gee_zip_future_go_join (GeeZipFuture* self, gconstpointer left, gconstpointer right);
static void ___lambda44__gee_future_when_done_func (gconstpointer value, gpointer self);
static void ___lambda43__gee_future_when_done_func (gconstpointer value, gpointer self);
static gconstpointer gee_zip_future_real_wait (GeeFuture* base);
gconstpointer gee_future_wait (GeeFuture* self);
static gboolean gee_zip_future_real_wait_until (GeeFuture* base, gint64 end_time, gconstpointer* value);
gboolean gee_future_wait_until (GeeFuture* self, gint64 end_time, gconstpointer* value);
static void gee_zip_future_real_wait_async_data_free (gpointer _data);
static void gee_zip_future_real_wait_async (GeeFuture* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean gee_zip_future_real_wait_async_co (GeeZipFutureWaitAsyncData* _data_);
static Block21Data* block21_data_ref (Block21Data* _data21_);
static void block21_data_unref (void * _userdata_);
void gee_future_wait_async (GeeFuture* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
gconstpointer gee_future_wait_finish (GeeFuture* self, GAsyncResult* _res_);
static void gee_zip_future_wait_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void ___lambda45_ (Block21Data* _data21_, gconstpointer res);
static void ____lambda45__gee_future_when_done_func (gconstpointer value, gpointer self);
void gee_future_when_done_array_element_init (GeeFutureWhenDoneArrayElement *self, GeeFutureWhenDoneFunc func, void* func_target);
static void _vala_array_add7 (GeeFutureWhenDoneArrayElement** array, int* length, int* size, const GeeFutureWhenDoneArrayElement* value);
static void gee_zip_future_real_when_done (GeeFuture* base, GeeFutureWhenDoneFunc func, void* func_target);
static void _vala_array_add8 (GeeFutureWhenDoneArrayElement** array, int* length, int* size, const GeeFutureWhenDoneArrayElement* value);
static void gee_zip_future_finalize (GObject* obj);
gboolean gee_future_get_ready (GeeFuture* self);
static void _vala_gee_zip_future_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gee_zip_future_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_clear_GMutex (GMutex * mutex);
static void _vala_clear_GRecMutex (GRecMutex * mutex);
static void _vala_clear_GRWLock (GRWLock * mutex);
static void _vala_clear_GCond (GCond * mutex);


static GType gee_zip_future_progress_get_type (void) {
	static volatile gsize gee_zip_future_progress_type_id__volatile = 0;
	if (g_once_init_enter (&gee_zip_future_progress_type_id__volatile)) {
		static const GEnumValue values[] = {{GEE_ZIP_FUTURE_PROGRESS_INIT, "GEE_ZIP_FUTURE_PROGRESS_INIT", "init"}, {GEE_ZIP_FUTURE_PROGRESS_PROGRESS, "GEE_ZIP_FUTURE_PROGRESS_PROGRESS", "progress"}, {GEE_ZIP_FUTURE_PROGRESS_READY, "GEE_ZIP_FUTURE_PROGRESS_READY", "ready"}, {0, NULL, NULL}};
		GType gee_zip_future_progress_type_id;
		gee_zip_future_progress_type_id = g_enum_register_static ("GeeZipFutureProgress", values);
		g_once_init_leave (&gee_zip_future_progress_type_id__volatile, gee_zip_future_progress_type_id);
	}
	return gee_zip_future_progress_type_id__volatile;
}


static void _vala_GeeFutureWhenDoneArrayElement_array_free (GeeFutureWhenDoneArrayElement* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			gee_future_when_done_array_element_destroy (&array[i]);
		}
	}
	g_free (array);
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static Block20Data* block20_data_ref (Block20Data* _data20_) {
	g_atomic_int_inc (&_data20_->_ref_count_);
	return _data20_;
}


static void block20_data_unref (void * _userdata_) {
	Block20Data* _data20_;
	_data20_ = (Block20Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data20_->_ref_count_)) {
		GeeZipFuture * self;
		self = _data20_->self;
		((_data20_->l == NULL) || (self->priv->a_destroy_func == NULL)) ? NULL : (_data20_->l = (self->priv->a_destroy_func (_data20_->l), NULL));
		_g_object_unref0 (self);
		g_slice_free (Block20Data, _data20_);
	}
}


static void __lambda44_ (Block20Data* _data20_, gconstpointer r) {
	GeeZipFuture * self;
	GeeZipFutureProgress _tmp0_ = 0;
	self = _data20_->self;
	g_mutex_lock (&self->priv->_mutex);
	_tmp0_ = self->priv->_progress;
	if (_tmp0_ == GEE_ZIP_FUTURE_PROGRESS_INIT) {
		gconstpointer _tmp1_ = NULL;
		gconstpointer _tmp2_ = NULL;
		_tmp1_ = _data20_->l;
		_tmp2_ = r;
		gee_zip_future_go_join (self, _tmp1_, _tmp2_);
	} else {
		g_mutex_unlock (&self->priv->_mutex);
	}
}


static void ___lambda44__gee_future_when_done_func (gconstpointer value, gpointer self) {
	__lambda44_ (self, value);
	block20_data_unref (self);
}


static void __lambda43_ (GeeZipFuture* self, gconstpointer l) {
	Block20Data* _data20_;
	gconstpointer _tmp0_ = NULL;
	gpointer _tmp1_ = NULL;
	GeeFuture* _tmp2_ = NULL;
	_data20_ = g_slice_new0 (Block20Data);
	_data20_->_ref_count_ = 1;
	_data20_->self = g_object_ref (self);
	_tmp0_ = l;
	_tmp1_ = ((_tmp0_ != NULL) && (self->priv->a_dup_func != NULL)) ? self->priv->a_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_);
	((_data20_->l == NULL) || (self->priv->a_destroy_func == NULL)) ? NULL : (_data20_->l = (self->priv->a_destroy_func (_data20_->l), NULL));
	_data20_->l = _tmp1_;
	_tmp2_ = self->priv->_right;
	gee_future_when_done (_tmp2_, ___lambda44__gee_future_when_done_func, block20_data_ref (_data20_));
	block20_data_unref (_data20_);
	_data20_ = NULL;
}


static void ___lambda43__gee_future_when_done_func (gconstpointer value, gpointer self) {
	__lambda43_ (self, value);
	g_object_unref (self);
}


GeeZipFuture* gee_zip_future_construct (GType object_type, GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GType c_type, GBoxedCopyFunc c_dup_func, GDestroyNotify c_destroy_func, GeeFutureZipFunc func, void* func_target, GeeFuture* left, GeeFuture* right) {
	GeeZipFuture * self = NULL;
	GeeFuture* _tmp0_ = NULL;
	GeeFuture* _tmp1_ = NULL;
	GeeFuture* _tmp2_ = NULL;
	GeeFuture* _tmp3_ = NULL;
	GeeFutureZipFunc _tmp4_ = NULL;
	void* _tmp4__target = NULL;
	GeeFuture* _tmp5_ = NULL;
	g_return_val_if_fail (left != NULL, NULL);
	g_return_val_if_fail (right != NULL, NULL);
	self = (GeeZipFuture*) g_object_new (object_type, NULL);
	self->priv->a_type = a_type;
	self->priv->a_dup_func = a_dup_func;
	self->priv->a_destroy_func = a_destroy_func;
	self->priv->b_type = b_type;
	self->priv->b_dup_func = b_dup_func;
	self->priv->b_destroy_func = b_destroy_func;
	self->priv->c_type = c_type;
	self->priv->c_dup_func = c_dup_func;
	self->priv->c_destroy_func = c_destroy_func;
	_tmp0_ = left;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_left);
	self->priv->_left = _tmp1_;
	_tmp2_ = right;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->_right);
	self->priv->_right = _tmp3_;
	_tmp4_ = func;
	_tmp4__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 = _tmp4_;
	self->priv->_func_target = _tmp4__target;
	self->priv->_func_target_destroy_notify = NULL;
	_tmp5_ = self->priv->_left;
	gee_future_when_done (_tmp5_, ___lambda43__gee_future_when_done_func, g_object_ref (self));
	return self;
}


GeeZipFuture* gee_zip_future_new (GType a_type, GBoxedCopyFunc a_dup_func, GDestroyNotify a_destroy_func, GType b_type, GBoxedCopyFunc b_dup_func, GDestroyNotify b_destroy_func, GType c_type, GBoxedCopyFunc c_dup_func, GDestroyNotify c_destroy_func, GeeFutureZipFunc func, void* func_target, GeeFuture* left, GeeFuture* right) {
	return gee_zip_future_construct (GEE_TYPE_ZIP_FUTURE, a_type, a_dup_func, a_destroy_func, b_type, b_dup_func, b_destroy_func, c_type, c_dup_func, c_destroy_func, func, func_target, left, right);
}


static gconstpointer gee_zip_future_real_wait (GeeFuture* base) {
	GeeZipFuture * self;
	gconstpointer result = NULL;
	GeeZipFutureProgress progress = 0;
	GeeZipFutureProgress _tmp0_ = 0;
	GeeZipFutureProgress _tmp1_ = 0;
	GeeZipFutureProgress _tmp8_ = 0;
	GeeZipFutureProgress _tmp10_ = 0;
	self = (GeeZipFuture*) base;
	g_mutex_lock (&self->priv->_mutex);
	_tmp0_ = self->priv->_progress;
	progress = _tmp0_;
	_tmp1_ = progress;
	if (_tmp1_ == GEE_ZIP_FUTURE_PROGRESS_INIT) {
		GeeFuture* left = NULL;
		GeeFuture* _tmp2_ = NULL;
		GeeFuture* _tmp3_ = NULL;
		GeeFuture* right = NULL;
		GeeFuture* _tmp4_ = NULL;
		GeeFuture* _tmp5_ = NULL;
		GeeFuture* _tmp6_ = NULL;
		GeeFuture* _tmp7_ = NULL;
		_tmp2_ = self->priv->_left;
		_tmp3_ = _g_object_ref0 (_tmp2_);
		left = _tmp3_;
		_tmp4_ = self->priv->_right;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		right = _tmp5_;
		g_mutex_unlock (&self->priv->_mutex);
		_tmp6_ = left;
		gee_future_wait (_tmp6_);
		_tmp7_ = right;
		gee_future_wait (_tmp7_);
		g_mutex_lock (&self->priv->_mutex);
		progress = GEE_ZIP_FUTURE_PROGRESS_PROGRESS;
		_g_object_unref0 (right);
		_g_object_unref0 (left);
	}
	_tmp8_ = progress;
	if (_tmp8_ == GEE_ZIP_FUTURE_PROGRESS_PROGRESS) {
		GMutex _tmp9_ = {0};
		_tmp9_ = self->priv->_mutex;
		g_cond_wait (&self->priv->_cond, &_tmp9_);
		progress = GEE_ZIP_FUTURE_PROGRESS_READY;
	}
	_tmp10_ = progress;
	if (_tmp10_ == GEE_ZIP_FUTURE_PROGRESS_READY) {
		gconstpointer _tmp11_ = NULL;
		g_mutex_unlock (&self->priv->_mutex);
		_tmp11_ = self->priv->_value;
		result = _tmp11_;
		return result;
	}
	g_assert_not_reached ();
}


static gboolean gee_zip_future_real_wait_until (GeeFuture* base, gint64 end_time, gconstpointer* value) {
	GeeZipFuture * self;
	gconstpointer _vala_value = NULL;
	gboolean result = FALSE;
	GeeZipFutureProgress progress = 0;
	GeeZipFutureProgress _tmp0_ = 0;
	GeeZipFutureProgress _tmp1_ = 0;
	GeeZipFutureProgress _tmp12_ = 0;
	GeeZipFutureProgress _tmp16_ = 0;
	self = (GeeZipFuture*) base;
	g_mutex_lock (&self->priv->_mutex);
	_tmp0_ = self->priv->_progress;
	progress = _tmp0_;
	_tmp1_ = progress;
	if (_tmp1_ == GEE_ZIP_FUTURE_PROGRESS_INIT) {
		GeeFuture* left = NULL;
		GeeFuture* _tmp2_ = NULL;
		GeeFuture* _tmp3_ = NULL;
		GeeFuture* right = NULL;
		GeeFuture* _tmp4_ = NULL;
		GeeFuture* _tmp5_ = NULL;
		GeeFuture* _tmp6_ = NULL;
		gint64 _tmp7_ = 0LL;
		gboolean _tmp8_ = FALSE;
		GeeFuture* _tmp9_ = NULL;
		gint64 _tmp10_ = 0LL;
		gboolean _tmp11_ = FALSE;
		_tmp2_ = self->priv->_left;
		_tmp3_ = _g_object_ref0 (_tmp2_);
		left = _tmp3_;
		_tmp4_ = self->priv->_right;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		right = _tmp5_;
		g_mutex_unlock (&self->priv->_mutex);
		_tmp6_ = left;
		_tmp7_ = end_time;
		_tmp8_ = gee_future_wait_until (_tmp6_, _tmp7_, NULL);
		if (!_tmp8_) {
			result = FALSE;
			_g_object_unref0 (right);
			_g_object_unref0 (left);
			if (value) {
				*value = _vala_value;
			}
			return result;
		}
		_tmp9_ = right;
		_tmp10_ = end_time;
		_tmp11_ = gee_future_wait_until (_tmp9_, _tmp10_, NULL);
		if (!_tmp11_) {
			result = FALSE;
			_g_object_unref0 (right);
			_g_object_unref0 (left);
			if (value) {
				*value = _vala_value;
			}
			return result;
		}
		g_mutex_lock (&self->priv->_mutex);
		progress = GEE_ZIP_FUTURE_PROGRESS_PROGRESS;
		_g_object_unref0 (right);
		_g_object_unref0 (left);
	}
	_tmp12_ = progress;
	if (_tmp12_ == GEE_ZIP_FUTURE_PROGRESS_PROGRESS) {
		GMutex _tmp13_ = {0};
		gint64 _tmp14_ = 0LL;
		gboolean _tmp15_ = FALSE;
		_tmp13_ = self->priv->_mutex;
		_tmp14_ = end_time;
		_tmp15_ = g_cond_wait_until (&self->priv->_cond, &_tmp13_, _tmp14_);
		if (!_tmp15_) {
			g_mutex_unlock (&self->priv->_mutex);
			result = FALSE;
			if (value) {
				*value = _vala_value;
			}
			return result;
		}
		progress = GEE_ZIP_FUTURE_PROGRESS_READY;
	}
	_tmp16_ = progress;
	if (_tmp16_ == GEE_ZIP_FUTURE_PROGRESS_READY) {
		gconstpointer _tmp17_ = NULL;
		g_mutex_unlock (&self->priv->_mutex);
		_tmp17_ = self->priv->_value;
		_vala_value = _tmp17_;
		result = TRUE;
		if (value) {
			*value = _vala_value;
		}
		return result;
	}
	g_assert_not_reached ();
	if (value) {
		*value = _vala_value;
	}
}


static void gee_zip_future_real_wait_async_data_free (gpointer _data) {
	GeeZipFutureWaitAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GeeZipFutureWaitAsyncData, _data_);
}


static void gee_zip_future_real_wait_async (GeeFuture* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	GeeZipFuture * self;
	GeeZipFutureWaitAsyncData* _data_;
	GeeZipFuture* _tmp0_ = NULL;
	self = (GeeZipFuture*) base;
	_data_ = g_slice_new0 (GeeZipFutureWaitAsyncData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, gee_zip_future_real_wait_async);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, gee_zip_future_real_wait_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	gee_zip_future_real_wait_async_co (_data_);
}


static gconstpointer gee_zip_future_real_wait_finish (GeeFuture* base, GAsyncResult* _res_) {
	gconstpointer result;
	GeeZipFutureWaitAsyncData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static Block21Data* block21_data_ref (Block21Data* _data21_) {
	g_atomic_int_inc (&_data21_->_ref_count_);
	return _data21_;
}


static void block21_data_unref (void * _userdata_) {
	Block21Data* _data21_;
	_data21_ = (Block21Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data21_->_ref_count_)) {
		GeeZipFuture * self;
		self = _data21_->self;
		_g_object_unref0 (self);
		g_slice_free (Block21Data, _data21_);
	}
}


static void gee_zip_future_wait_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	GeeZipFutureWaitAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gee_zip_future_real_wait_async_co (_data_);
}


static void ___lambda45_ (Block21Data* _data21_, gconstpointer res) {
	GeeZipFuture * self;
	self = _data21_->self;
	gee_zip_future_real_wait_async_co (_data21_->_async_data_);
}


static void ____lambda45__gee_future_when_done_func (gconstpointer value, gpointer self) {
	___lambda45_ (self, value);
	block21_data_unref (self);
}


static void _vala_array_add7 (GeeFutureWhenDoneArrayElement** array, int* length, int* size, const GeeFutureWhenDoneArrayElement* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GeeFutureWhenDoneArrayElement, *array, *size);
	}
	(*array)[(*length)++] = *value;
}


static gboolean gee_zip_future_real_wait_async_co (GeeZipFutureWaitAsyncData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data21_ = g_slice_new0 (Block21Data);
	_data_->_data21_->_ref_count_ = 1;
	_data_->_data21_->self = g_object_ref (_data_->self);
	_data_->_data21_->_async_data_ = _data_;
	g_mutex_lock (&_data_->self->priv->_mutex);
	_data_->_tmp0_ = 0;
	_data_->_tmp0_ = _data_->self->priv->_progress;
	_data_->progress = _data_->_tmp0_;
	_data_->_tmp1_ = 0;
	_data_->_tmp1_ = _data_->progress;
	if (_data_->_tmp1_ == GEE_ZIP_FUTURE_PROGRESS_INIT) {
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = _data_->self->priv->_left;
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _g_object_ref0 (_data_->_tmp2_);
		_data_->left = _data_->_tmp3_;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->self->priv->_right;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _g_object_ref0 (_data_->_tmp4_);
		_data_->right = _data_->_tmp5_;
		g_mutex_unlock (&_data_->self->priv->_mutex);
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->left;
		_data_->_state_ = 1;
		gee_future_wait_async (_data_->_tmp6_, gee_zip_future_wait_async_ready, _data_);
		return FALSE;
		_state_1:
		gee_future_wait_finish (_data_->_tmp6_, _data_->_res_);
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = _data_->right;
		_data_->_state_ = 2;
		gee_future_wait_async (_data_->_tmp7_, gee_zip_future_wait_async_ready, _data_);
		return FALSE;
		_state_2:
		gee_future_wait_finish (_data_->_tmp7_, _data_->_res_);
		g_mutex_lock (&_data_->self->priv->_mutex);
		_data_->progress = GEE_ZIP_FUTURE_PROGRESS_PROGRESS;
		_g_object_unref0 (_data_->right);
		_g_object_unref0 (_data_->left);
	}
	_data_->_tmp8_ = 0;
	_data_->_tmp8_ = _data_->progress;
	if (_data_->_tmp8_ == GEE_ZIP_FUTURE_PROGRESS_PROGRESS) {
		_data_->_result_ = NULL;
		_data_->_tmp9_ = NULL;
		_data_->_tmp9__length1 = 0;
		_data_->_tmp9_ = _data_->self->priv->_when_done;
		_data_->_tmp9__length1 = _data_->self->priv->_when_done_length1;
		memset (&_data_->_tmp10_, 0, sizeof (GeeFutureWhenDoneArrayElement));
		gee_future_when_done_array_element_init (&_data_->_tmp10_, ____lambda45__gee_future_when_done_func, block21_data_ref (_data_->_data21_));
		_vala_array_add7 (&_data_->self->priv->_when_done, &_data_->self->priv->_when_done_length1, &_data_->self->priv->__when_done_size_, &_data_->_tmp10_);
		g_mutex_unlock (&_data_->self->priv->_mutex);
		_data_->_state_ = 3;
		return FALSE;
		_state_3:
		;
		_data_->_tmp11_ = NULL;
		_data_->_tmp11_ = _data_->self->priv->_value;
		_data_->result = _data_->_tmp11_;
		block21_data_unref (_data_->_data21_);
		_data_->_data21_ = NULL;
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp12_ = 0;
	_data_->_tmp12_ = _data_->progress;
	if (_data_->_tmp12_ == GEE_ZIP_FUTURE_PROGRESS_READY) {
		g_mutex_unlock (&_data_->self->priv->_mutex);
		_data_->_tmp13_ = NULL;
		_data_->_tmp13_ = _data_->self->priv->_value;
		_data_->result = _data_->_tmp13_;
		block21_data_unref (_data_->_data21_);
		_data_->_data21_ = NULL;
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_assert_not_reached ();
	block21_data_unref (_data_->_data21_);
	_data_->_data21_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _vala_array_add8 (GeeFutureWhenDoneArrayElement** array, int* length, int* size, const GeeFutureWhenDoneArrayElement* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GeeFutureWhenDoneArrayElement, *array, *size);
	}
	(*array)[(*length)++] = *value;
}


static void gee_zip_future_real_when_done (GeeFuture* base, GeeFutureWhenDoneFunc func, void* func_target) {
	GeeZipFuture * self;
	GeeZipFutureProgress _tmp0_ = 0;
	self = (GeeZipFuture*) base;
	g_mutex_lock (&self->priv->_mutex);
	_tmp0_ = self->priv->_progress;
	if (_tmp0_ == GEE_ZIP_FUTURE_PROGRESS_READY) {
		GeeFutureWhenDoneFunc _tmp1_ = NULL;
		void* _tmp1__target = NULL;
		gconstpointer _tmp2_ = NULL;
		g_mutex_unlock (&self->priv->_mutex);
		_tmp1_ = func;
		_tmp1__target = func_target;
		_tmp2_ = self->priv->_value;
		_tmp1_ (_tmp2_, _tmp1__target);
	} else {
		GeeFutureWhenDoneArrayElement* _tmp3_ = NULL;
		gint _tmp3__length1 = 0;
		GeeFutureWhenDoneFunc _tmp4_ = NULL;
		void* _tmp4__target = NULL;
		GeeFutureWhenDoneArrayElement _tmp5_ = {0};
		_tmp3_ = self->priv->_when_done;
		_tmp3__length1 = self->priv->_when_done_length1;
		_tmp4_ = func;
		_tmp4__target = func_target;
		gee_future_when_done_array_element_init (&_tmp5_, _tmp4_, _tmp4__target);
		_vala_array_add8 (&self->priv->_when_done, &self->priv->_when_done_length1, &self->priv->__when_done_size_, &_tmp5_);
		g_mutex_unlock (&self->priv->_mutex);
	}
}


static inline gconstpointer gee_zip_future_go_join (GeeZipFuture* self, gconstpointer left, gconstpointer right) {
	gconstpointer result = NULL;
	gpointer tmp_value = NULL;
	GeeFutureZipFunc _tmp0_ = NULL;
	void* _tmp0__target = NULL;
	gconstpointer _tmp1_ = NULL;
	gconstpointer _tmp2_ = NULL;
	gpointer _tmp3_ = NULL;
	gconstpointer value = NULL;
	gconstpointer _tmp4_ = NULL;
	gpointer _tmp5_ = NULL;
	GeeFutureWhenDoneArrayElement* when_done = NULL;
	GeeFutureWhenDoneArrayElement* _tmp6_ = NULL;
	gint _tmp6__length1 = 0;
	gint when_done_length1 = 0;
	gint _when_done_size_ = 0;
	gconstpointer _tmp17_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	self->priv->_progress = GEE_ZIP_FUTURE_PROGRESS_PROGRESS;
	g_mutex_unlock (&self->priv->_mutex);
	_tmp0_ = self->priv->_func;
	_tmp0__target = self->priv->_func_target;
	_tmp1_ = left;
	_tmp2_ = right;
	_tmp3_ = _tmp0_ (_tmp1_, _tmp2_, _tmp0__target);
	tmp_value = _tmp3_;
	_tmp4_ = tmp_value;
	value = _tmp4_;
	g_mutex_lock (&self->priv->_mutex);
	_tmp5_ = tmp_value;
	tmp_value = NULL;
	((self->priv->_value == NULL) || (self->priv->c_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->c_destroy_func (self->priv->_value), NULL));
	self->priv->_value = _tmp5_;
	self->priv->_progress = GEE_ZIP_FUTURE_PROGRESS_READY;
	g_cond_broadcast (&self->priv->_cond);
	g_mutex_unlock (&self->priv->_mutex);
	_tmp6_ = self->priv->_when_done;
	_tmp6__length1 = self->priv->_when_done_length1;
	self->priv->_when_done = NULL;
	when_done = _tmp6_;
	when_done_length1 = _tmp6__length1;
	_when_done_size_ = when_done_length1;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				gboolean _tmp8_ = FALSE;
				gint _tmp10_ = 0;
				GeeFutureWhenDoneArrayElement* _tmp11_ = NULL;
				gint _tmp11__length1 = 0;
				GeeFutureWhenDoneArrayElement* _tmp12_ = NULL;
				gint _tmp12__length1 = 0;
				gint _tmp13_ = 0;
				GeeFutureWhenDoneArrayElement _tmp14_ = {0};
				GeeFutureWhenDoneFunc _tmp15_ = NULL;
				void* _tmp15__target = NULL;
				gconstpointer _tmp16_ = NULL;
				_tmp8_ = _tmp7_;
				if (!_tmp8_) {
					gint _tmp9_ = 0;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp7_ = FALSE;
				_tmp10_ = i;
				_tmp11_ = when_done;
				_tmp11__length1 = when_done_length1;
				if (!(_tmp10_ < _tmp11__length1)) {
					break;
				}
				_tmp12_ = when_done;
				_tmp12__length1 = when_done_length1;
				_tmp13_ = i;
				_tmp14_ = _tmp12_[_tmp13_];
				_tmp15_ = _tmp14_.func;
				_tmp15__target = _tmp14_.func_target;
				_tmp16_ = value;
				_tmp15_ (_tmp16_, _tmp15__target);
			}
		}
	}
	_g_object_unref0 (self->priv->_left);
	self->priv->_left = NULL;
	_g_object_unref0 (self->priv->_right);
	self->priv->_right = NULL;
	(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 = NULL;
	self->priv->_func_target = NULL;
	self->priv->_func_target_destroy_notify = NULL;
	_tmp17_ = value;
	result = _tmp17_;
	when_done = (_vala_GeeFutureWhenDoneArrayElement_array_free (when_done, when_done_length1), NULL);
	((tmp_value == NULL) || (self->priv->c_destroy_func == NULL)) ? NULL : (tmp_value = (self->priv->c_destroy_func (tmp_value), NULL));
	return result;
}


static gboolean gee_zip_future_real_get_ready (GeeFuture* base) {
	gboolean result;
	GeeZipFuture* self;
	gboolean _result_ = FALSE;
	GeeZipFutureProgress _tmp0_ = 0;
	self = (GeeZipFuture*) base;
	g_mutex_lock (&self->priv->_mutex);
	_tmp0_ = self->priv->_progress;
	_result_ = _tmp0_ == GEE_ZIP_FUTURE_PROGRESS_READY;
	g_mutex_unlock (&self->priv->_mutex);
	result = _result_;
	return result;
}


static void gee_zip_future_class_init (GeeZipFutureClass * klass) {
	gee_zip_future_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GeeZipFuturePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gee_zip_future_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gee_zip_future_set_property;
	G_OBJECT_CLASS (klass)->finalize = gee_zip_future_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_A_TYPE, g_param_spec_gtype ("a-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_A_DUP_FUNC, g_param_spec_pointer ("a-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_A_DESTROY_FUNC, g_param_spec_pointer ("a-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_B_TYPE, g_param_spec_gtype ("b-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_B_DUP_FUNC, g_param_spec_pointer ("b-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_B_DESTROY_FUNC, g_param_spec_pointer ("b-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_C_TYPE, g_param_spec_gtype ("c-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_C_DUP_FUNC, g_param_spec_pointer ("c-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_C_DESTROY_FUNC, g_param_spec_pointer ("c-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GEE_ZIP_FUTURE_READY, g_param_spec_boolean ("ready", "ready", "ready", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static GType gee_zip_future_gee_future_get_g_type (GeeZipFuture* self) {
	return self->priv->c_type;
}


static GBoxedCopyFunc gee_zip_future_gee_future_get_g_dup_func (GeeZipFuture* self) {
	return self->priv->c_dup_func;
}


static GDestroyNotify gee_zip_future_gee_future_get_g_destroy_func (GeeZipFuture* self) {
	return self->priv->c_destroy_func;
}


static void gee_zip_future_gee_future_interface_init (GeeFutureIface * iface) {
	gee_zip_future_gee_future_parent_iface = g_type_interface_peek_parent (iface);
	iface->wait = (gconstpointer (*)(GeeFuture*)) gee_zip_future_real_wait;
	iface->wait_until = (gboolean (*)(GeeFuture*, gint64, gconstpointer*)) gee_zip_future_real_wait_until;
	iface->wait_async = (gconstpointer (*)(GeeFuture*)) gee_zip_future_real_wait_async;
	iface->wait_finish = gee_zip_future_real_wait_finish;
	iface->when_done = (void (*)(GeeFuture*, GeeFutureWhenDoneFunc, void*)) gee_zip_future_real_when_done;
	iface->get_g_type = (GType(*)(GeeFuture*)) gee_zip_future_gee_future_get_g_type;
	iface->get_g_dup_func = (GBoxedCopyFunc(*)(GeeFuture*)) gee_zip_future_gee_future_get_g_dup_func;
	iface->get_g_destroy_func = (GDestroyNotify(*)(GeeFuture*)) gee_zip_future_gee_future_get_g_destroy_func;
	iface->get_ready = gee_zip_future_real_get_ready;
}


static void gee_zip_future_instance_init (GeeZipFuture * self) {
	GMutex _tmp0_ = {0};
	GCond _tmp1_ = {0};
	GeeFutureWhenDoneArrayElement* _tmp2_ = NULL;
	self->priv = GEE_ZIP_FUTURE_GET_PRIVATE (self);
	g_mutex_init (&_tmp0_);
	self->priv->_mutex = _tmp0_;
	g_cond_init (&_tmp1_);
	self->priv->_cond = _tmp1_;
	_tmp2_ = g_new0 (GeeFutureWhenDoneArrayElement, 0);
	self->priv->_when_done = _tmp2_;
	self->priv->_when_done_length1 = 0;
	self->priv->__when_done_size_ = self->priv->_when_done_length1;
	self->priv->_progress = GEE_ZIP_FUTURE_PROGRESS_INIT;
}


static void gee_zip_future_finalize (GObject* obj) {
	GeeZipFuture * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_ZIP_FUTURE, GeeZipFuture);
	_vala_clear_GMutex (&self->priv->_mutex);
	_vala_clear_GCond (&self->priv->_cond);
	_g_object_unref0 (self->priv->_left);
	_g_object_unref0 (self->priv->_right);
	(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->_value == NULL) || (self->priv->c_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->c_destroy_func (self->priv->_value), NULL));
	self->priv->_when_done = (_vala_GeeFutureWhenDoneArrayElement_array_free (self->priv->_when_done, self->priv->_when_done_length1), NULL);
	G_OBJECT_CLASS (gee_zip_future_parent_class)->finalize (obj);
}


GType gee_zip_future_get_type (void) {
	static volatile gsize gee_zip_future_type_id__volatile = 0;
	if (g_once_init_enter (&gee_zip_future_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GeeZipFutureClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_zip_future_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeZipFuture), 0, (GInstanceInitFunc) gee_zip_future_instance_init, NULL };
		static const GInterfaceInfo gee_future_info = { (GInterfaceInitFunc) gee_zip_future_gee_future_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gee_zip_future_type_id;
		gee_zip_future_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeZipFuture", &g_define_type_info, 0);
		g_type_add_interface_static (gee_zip_future_type_id, GEE_TYPE_FUTURE, &gee_future_info);
		g_once_init_leave (&gee_zip_future_type_id__volatile, gee_zip_future_type_id);
	}
	return gee_zip_future_type_id__volatile;
}


static void _vala_gee_zip_future_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GeeZipFuture * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ZIP_FUTURE, GeeZipFuture);
	switch (property_id) {
		case GEE_ZIP_FUTURE_READY:
		g_value_set_boolean (value, gee_future_get_ready ((GeeFuture*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gee_zip_future_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GeeZipFuture * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GEE_TYPE_ZIP_FUTURE, GeeZipFuture);
	switch (property_id) {
		case GEE_ZIP_FUTURE_A_TYPE:
		self->priv->a_type = g_value_get_gtype (value);
		break;
		case GEE_ZIP_FUTURE_A_DUP_FUNC:
		self->priv->a_dup_func = g_value_get_pointer (value);
		break;
		case GEE_ZIP_FUTURE_A_DESTROY_FUNC:
		self->priv->a_destroy_func = g_value_get_pointer (value);
		break;
		case GEE_ZIP_FUTURE_B_TYPE:
		self->priv->b_type = g_value_get_gtype (value);
		break;
		case GEE_ZIP_FUTURE_B_DUP_FUNC:
		self->priv->b_dup_func = g_value_get_pointer (value);
		break;
		case GEE_ZIP_FUTURE_B_DESTROY_FUNC:
		self->priv->b_destroy_func = g_value_get_pointer (value);
		break;
		case GEE_ZIP_FUTURE_C_TYPE:
		self->priv->c_type = g_value_get_gtype (value);
		break;
		case GEE_ZIP_FUTURE_C_DUP_FUNC:
		self->priv->c_dup_func = g_value_get_pointer (value);
		break;
		case GEE_ZIP_FUTURE_C_DESTROY_FUNC:
		self->priv->c_destroy_func = g_value_get_pointer (value);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_clear_GMutex (GMutex * mutex) {
	GMutex zero_mutex = { 0 };
	if (memcmp (mutex, &zero_mutex, sizeof (GMutex))) {
		g_mutex_clear (mutex);
		memset (mutex, 0, sizeof (GMutex));
	}
}


static void _vala_clear_GRecMutex (GRecMutex * mutex) {
	GRecMutex zero_mutex = { 0 };
	if (memcmp (mutex, &zero_mutex, sizeof (GRecMutex))) {
		g_rec_mutex_clear (mutex);
		memset (mutex, 0, sizeof (GRecMutex));
	}
}


static void _vala_clear_GRWLock (GRWLock * mutex) {
	GRWLock zero_mutex = { 0 };
	if (memcmp (mutex, &zero_mutex, sizeof (GRWLock))) {
		g_rw_lock_clear (mutex);
		memset (mutex, 0, sizeof (GRWLock));
	}
}


static void _vala_clear_GCond (GCond * mutex) {
	GCond zero_mutex = { 0 };
	if (memcmp (mutex, &zero_mutex, sizeof (GCond))) {
		g_cond_clear (mutex);
		memset (mutex, 0, sizeof (GCond));
	}
}



