[gnet-dev] Async DNS bug workaround



The bug seems to be this: if GNet uses GLib 2.0 and pthreads for async
DNS, then g_thread_init(NULL) must be called at the beginning of main.
This wasn't a problem with GLib 1.2.

The obvious workaround is to call g_thread_init(NULL) at the beginning of
your program.  However, your program may link with a version of GNet that
doesn't require threads, so this would result in an unneccessary, small
performance penalty.  The proper solution would be for me to add a
gnet_init() function that calls g_thread_init() if necessary.  I will add
this in the next release.

However, you will then need to link your program with gthread, because
gnet doesn't do it properly (bug #2 in gnet-config.in).  pkg-config is
correct, but gnet-config doesn't include the gthread cflags and libs.
Also, GNet itself doesn't get linked with gthread either when it should
(bug #3).

I'll commit a fix this weekend and probably make a release this week.

Examples should build with GLib 2.0.  I did "make install" then "make
examples" and it built and linked correctly.

David

-- 
      __          _    __ David Helder - dhelder umich edu
  ___/ /__ __  __(_)__/ / <http://www.eecs.umich.edu/~dhelder>
 / _  / _ `/ |/ / / _  /  Jungle Monkey: <http://www.junglemonkey.net>
 |_,_/|_,_/|___/_/|_,_/   Paper CD Case: <http://www.papercdcase.com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]