Single-threaded version of lcm?

35 views
Skip to first unread message

Fabrizio Benedetti

unread,
Oct 11, 2011, 5:55:18 AM10/11/11
to lcm-...@googlegroups.com
  Hi all,
I am evaluating the porting of lcm in my project, and I think I can state that I need a single-threaded version. I have a process running a custom scheduler inside, and I have to get rid of all the mutex locks which would interfere with it.

Here's my 1M$ questions: provided I ensure that lcm objects will ONLY and ALWAYS be invoked by a single thread, can I remove all the mutexes? If this could work, is there any chance that a single-treaded version which doens't use mutexes will become a build option in the official lcm repository? Incidentally, this could help in removing the GLib dependency which seems to be wanted by several people (though this is not my case).

Regards
  Fabrizio

Fabrizio Benedetti

unread,
Oct 11, 2011, 11:05:58 AM10/11/11
to lcm-...@googlegroups.com
I looked more deeply at the LCM code, and I saw the recv_thread: I wasn't aware of this additional thread which is being created - and of the loopback socket it creates (called the "pipe" in lcm_udp.c). I need some deeper understanding of the lcm internals...

Fabrizio

Albert Huang

unread,
Oct 18, 2011, 10:14:20 PM10/18/11
to lcm-...@googlegroups.com
HI Fabrizio,

Yes, the UDP multicast backend to LCM spawns a worker thread that
pulls messages off the receive socket. This thread is managed by LCM,
and is in general transparent to the user. I don't advise trying to
get rid of it. If you want to modify LCM for use on an embedded or
otherwise resource-constrained system, then it might be worth poking
around in the lcm-lite directory. There's some code in there that
demonstrates how you could adapt LCM to a non-POSIX system or create a
GLib-free implementation, but it will take some effort to get that
working.

Albert

> --
> You received this message because you are subscribed to the Google Groups
> "Lightweight Communications and Marshalling" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/lcm-users/-/jyRpTshLpEkJ.
> To post to this group, send email to lcm-...@googlegroups.com.
> To unsubscribe from this group, send email to
> lcm-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/lcm-users?hl=en.
>

Reply all
Reply to author
Forward
0 new messages