/*
 * Copyright (C) 2008 Red Hat, Inc.
 *
 * 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 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., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: David Zeuthen <davidz@redhat.com>
 */

#ifndef __G_FIBER_H
#define __G_FIBER_H

#include <gio/gio.h>

G_BEGIN_DECLS

#define G_TYPE_FIBER         (g_fiber_get_type())
#define G_FIBER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FIBER, GFiber))
#define G_FIBER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FIBER, GFiberClass))
#define G_FIBER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FIBER, GFiberClass))
#define G_IS_FIBER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FIBER))
#define G_IS_FIBER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FIBER))

typedef struct _GFiber GFiber;
typedef struct _GFiberClass GFiberClass;

GType                g_fiber_get_type (void) G_GNUC_CONST;
GAsyncReadyCallback  g_fiber_get_async_ready_callback (GFiber *fiber);
gpointer             g_fiber_get_async_ready_user_data (GFiber *fiber);
GAsyncResult        *g_fiber_get_async_result (GFiber *fiber);

void                 g_fiber_yield (GFiber *fiber);

typedef void (*GFiberFunc) (GFiber *fiber, gpointer user_data);

void                 g_fiber_run (GFiberFunc fiber_func, gpointer user_data);

void                 g_fiber_sleep (GFiber *fiber, guint msec);

G_END_DECLS

#endif /* __G_FIBER_H */
