1gensio_glib_funcs_alloc(3) Library Functions Manual gensio_glib_funcs_alloc(3)
2
3
4

NAME

6       gensio_glib_funcs_alloc  -  Abstraction for some operating system func‐
7       tions done with glib
8

SYNOPSIS

10       #include <gensio/gensio_glib.h>
11
12       int gensio_glib_funcs_alloc(struct gensio_os_funcs **o)
13

DESCRIPTION

15       This structure provides an abstraction for the gensio library that lets
16       it work on top of glib.  See the gensio_os_funcs.3 man page for details
17       on what this does.  This can be used if you have  a  project  based  on
18       glib that you want to integrate gensio into.
19
20       Unfortunately,  it  has  some  limitations because of weaknesses in the
21       glib interface.
22
23       If you use this, you really want to use the gensio wait functions,  not
24       g_cont_wait..()  yourself.  You don't strictly have have to, especially
25       if your app is single threaded, but especially  in  multithreaded  apps
26       you  cannot  mix calls to the os funcs wait functions and the glib wait
27       functions.  Which means you can't use the blocking functions, which all
28       use os func waiters.
29
30       Performance  should  be  ok for a single thread.  For multiple threads,
31       though, only on thing at a time can be waiting on the main glib thread.
32       This is a weakness in glib.  For multiple threads, one function sits in
33       the main context and the others sit on condition variables.   When  the
34       thead  sitting  on  the main context wakes up, it wakes another waiting
35       thread to take over.
36
37       If performance is important, it might be better to put glib on  top  of
38       gensio  os  funcs with g_main_context_set_poll_func().  I leave that as
39       an exercise to the reader.
40

RETURN VALUES

42       A gensio_err returns a standard gensio error.
43

SEE ALSO

45       gensio_os_funcs(3), gensio(5), gensio_err(3)
46
47
48
49                                  03 Feb 2021       gensio_glib_funcs_alloc(3)
Impressum