lua-users home
lua-l archive

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


On Fri, Jul 12, 2013 at 8:25 AM, Andrew Starks <andrew.starks@trms.com> wrote:
> Someone, somewhere has to manage a mutex to a message cue. No?

s/cue/queue/

but yes, if you want messages, you need a messaging construct.  it's
not too hard to do your own (i did mine for the helper threads
toolkit), but certainly 0MQ is an option.  it has a 'transport'
specifically optimized for inter-thread communications, and it's
well-tested.  as a bonus, you could use the same code if you spread
out of the process or even out of a single machine.

if you choose to write your own, keep in mind that the message can
carry a pointer to a bigger payload, avoiding the need to copy it; but
then you have to refrain from using that memory after you send the
message.   this is what 0MQ does internally, what Rob Kendrick said
about QNX, and what Go documentation suggest with the "don't
communicate by sharing memory, share memory by communicating"
(http://golang.org/doc/codewalk/sharemem/)

cheers,

--
Javier