General function.

Name

General function. -- Library initializing and other library wide functions.

Synopsis



#define     RR_ERROR
enum        RRError;
extern      const gint rr_major_version;
extern      const gint rr_minor_version;
extern      const gint rr_micro_version;
extern      const gint rr_interface_age;
extern      const gint rr_binary_age;
GQuark      rr_error_quark                  (void);
gboolean    rr_init                         (gint *argc,
                                             gchar ***argv,
                                             GError **error);
gboolean    rr_exit                         (GError **error);
gboolean    rr_quit                         (GError **error);
gboolean    rr_wait_until_done              (GError **error);
void        rr_set_max_work_threads         (int max);
gint        rr_get_max_work_threads         (void);
void        rr_main_work_pool_push          (RRWPGroup gid,
                                             GFunc func,
                                             gpointer data,
                                             gpointer user_data);
void        rr_main_work_pool_join          (RRWPGroup gid);
GMainContext* rr_get_main_context           (void);
guint       rr_add_watch_full               (GIOChannel *channel,
                                             gint priority,
                                             GIOCondition condition,
                                             GIOFunc func,
                                             gpointer user_data,
                                             GDestroyNotify notify);
gboolean    rr_source_remove                (guint tag);

Description

Before the RoadRunner framework can be used it has to be initialized. A function call to rr_init is all that is necessary to initialize the library. The resources used by the library can be freed using rr_exit.

Details

RR_ERROR

#define RR_ERROR (rr_error_quark ())


enum RRError

typedef enum
{
	RR_ERROR_OTHER,
	RR_ERROR_GETHOSTBYNAME,
	RR_ERROR_CONNECT,
	RR_ERROR_NOT_READY,
	RR_ERROR_DISCONNECTED,
	RR_ERROR_BIND,
	RR_ERROR_LISTEN,
	RR_ERROR_SOCKET,
	RR_ERROR_GETADDRINFO
} RRError;


rr_major_version

extern const gint rr_major_version;


rr_minor_version

extern const gint rr_minor_version;


rr_micro_version

extern const gint rr_micro_version;


rr_interface_age

extern const gint rr_interface_age;


rr_binary_age

extern const gint rr_binary_age;


rr_error_quark ()

GQuark      rr_error_quark                  (void);

Returns :


rr_init ()

gboolean    rr_init                         (gint *argc,
                                             gchar ***argv,
                                             GError **error);

Initializes RoadRunner and starts the event thread.

argc :

a pointer to argc or NULL.

argv :

a pointer to argv or NULL.

error :

location to return an error.

Returns :

TRUE on success, FALSE on failure.


rr_exit ()

gboolean    rr_exit                         (GError **error);

Terminates the RoadRunner event thread and free the resources allocated by rr_init.

error :

location to return an error.

Returns :

TRUE on success, FALSE on failure.


rr_quit ()

gboolean    rr_quit                         (GError **error);

Terminates the main loop. This will unblock rr_wait_until_done.

error :

location to return an error.

Returns :

TRUE on success, FALSE on failure.


rr_wait_until_done ()

gboolean    rr_wait_until_done              (GError **error);

Blocks until the RoadRunner event loop is done. (when rr_quit is called).

error :

location to return an error.

Returns :

TRUE on success, FALSE on failure.


rr_set_max_work_threads ()

void        rr_set_max_work_threads         (int max);

Sets the maximum number of threads roadrunner will use. This function should be called before rr_init.

max :

maximum number of threads.


rr_get_max_work_threads ()

gint        rr_get_max_work_threads         (void);

Returns the maximum number of threads that roadrunner will use.

Returns :

the number of threads.


rr_main_work_pool_push ()

void        rr_main_work_pool_push          (RRWPGroup gid,
                                             GFunc func,
                                             gpointer data,
                                             gpointer user_data);

Inserts func to the list of task to be executed by the roadrunner wide work pool. The work pool guarantees that two or more tasks with the same gid will never be executed in parallel.

gid :

a thread group id.

func :

a function to execute by one thread in the work pool.

data :

first argument to func

user_data :

second argument to func


rr_main_work_pool_join ()

void        rr_main_work_pool_join          (RRWPGroup gid);

blocks until all tasks in the roadrunner global work pool of the given gid are executed.

gid :

a thread group id


rr_get_main_context ()

GMainContext* rr_get_main_context           (void);

Returns :


rr_add_watch_full ()

guint       rr_add_watch_full               (GIOChannel *channel,
                                             gint priority,
                                             GIOCondition condition,
                                             GIOFunc func,
                                             gpointer user_data,
                                             GDestroyNotify notify);

channel :

priority :

condition :

func :

user_data :

notify :

Returns :


rr_source_remove ()

gboolean    rr_source_remove                (guint tag);

tag :

Returns :