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


#include <glib.h>
#include <glib-object.h>
#include <linux/input.h>
#include <fcntl.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <fsobasics.h>

#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))


extern GMainLoop* loop;
GMainLoop* loop = NULL;
extern struct input_event event;
struct input_event event = {0};

void test_async_reactorchannel (void);
static void __lambda2_ (void* data, gssize length);
static void ___lambda2__fso_framework_async_reactor_channel_action_func (void* data, gssize length, gpointer self);
void _vala_main (gchar** args, int args_length1);
static void _test_async_reactorchannel_gcallback (void);


static void __lambda2_ (void* data, gssize length) {
	gssize _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	GMainLoop* _tmp5_;
	_tmp0_ = length;
	_tmp1_ = g_strdup_printf ("%" G_GSSIZE_FORMAT, _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat ("got ", _tmp2_, " bytes of data", NULL);
	_tmp4_ = _tmp3_;
	g_debug ("testasync.vala:35: %s", _tmp4_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	_tmp5_ = loop;
	g_main_loop_quit (_tmp5_);
}


static void ___lambda2__fso_framework_async_reactor_channel_action_func (void* data, gssize length, gpointer self) {
	__lambda2_ (data, length);
}


void test_async_reactorchannel (void) {
	GMainLoop* _tmp0_;
	gint _tmp1_ = 0;
	gint fd;
	FsoFrameworkAsyncReactorChannel* _tmp2_;
	FsoFrameworkAsyncReactorChannel* chan;
	GMainLoop* _tmp3_;
	_tmp0_ = g_main_loop_new (NULL, FALSE);
	_g_main_loop_unref0 (loop);
	loop = _tmp0_;
	_tmp1_ = open ("/dev/zero", O_RDONLY, (mode_t) 0);
	fd = _tmp1_;
	_tmp2_ = fso_framework_async_reactor_channel_new (fd, ___lambda2__fso_framework_async_reactor_channel_action_func, NULL, NULL, (gsize) 16);
	chan = _tmp2_;
	_tmp3_ = loop;
	g_main_loop_run (_tmp3_);
	_g_object_unref0 (chan);
}


static void _test_async_reactorchannel_gcallback (void) {
	test_async_reactorchannel ();
}


void _vala_main (gchar** args, int args_length1) {
	g_test_init (&args_length1, &args, NULL);
	g_test_add_func ("/Async/ReactorChannel", _test_async_reactorchannel_gcallback);
	g_test_run ();
}


int main (int argc, char ** argv) {
	g_thread_init (NULL);
	g_type_init ();
	_vala_main (argv, argc);
	return 0;
}



