Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obsolete dependency on gthread-2.0 #76

Closed
tbeu opened this issue Jun 29, 2016 · 2 comments
Closed

Obsolete dependency on gthread-2.0 #76

tbeu opened this issue Jun 29, 2016 · 2 comments

Comments

@tbeu
Copy link
Contributor

tbeu commented Jun 29, 2016

In lcm.c there is if (!g_thread_supported ()) g_thread_init (NULL); Since g_thread_supported is defined to 1, function g_thread_init is never called and removed by the optimizing compiler. It anyway would do nothing, since in gthread-impl.c it is:

void g_thread_init (gpointer init) {
  if (init != NULL)
    g_warning ("GThread system no longer supports custom thread implementations.");
}

Therefore the dependency on gthread-2.0 can be removed.

@tprk77
Copy link
Member

tprk77 commented Jun 30, 2016

The GLib threading system used to be initialized with g_thread_init(). This is no longer necessary. Since version 2.32, the GLib threading system is automatically initialized at the start of your program, and all thread-creation functions and synchronization primitives are available right away.

So you're right, g_thread_supported and g_thread_init are both deprecated since 2012. We should be able to remove this code. But I'm a little confused about removing the gthread dependency, as it seems to built into glib now. I'll go take a look.

@tprk77
Copy link
Member

tprk77 commented Jun 30, 2016

Ok, so I think I see what you mean. In configure.ac for example we check:

PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.0.0 gthread-2.0 >= 2.0.0],,[AC_MSG_ERROR([LCM requires GLib >= 2.0])])

But we might be able to change this to something like:

PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.32.0],,[AC_MSG_ERROR([LCM requires GLib >= 2.32])])

Well, I'm kind of surprised this is a problem for you. On Ubuntu 16.04, glib-2.0 is still packaged with a libgthread-2.0.so. Are you having a specific linker problem?

tprk77 added a commit to tprk77/lcm that referenced this issue Jun 30, 2016
Fixes lcm-proj#76. Updated dependency of glib-2.0 to require version 2.32 or
higher, where possible. I'm not sure if it's possible to express this
for the Windows build.
mojasp pushed a commit to Barkhausen-Institut/lcm-sec that referenced this issue May 23, 2022
Fixes lcm-proj#76. Updated dependency of glib-2.0 to require version 2.32 or
higher, where possible. I'm not sure if it's possible to express this
for the Windows build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants