Discussion:
do nsm callbacks need thread synchronizations?
James Morris
2012-07-05 10:32:31 UTC
Permalink
Hi,

I'm using the API provided by nsm.h and have no experience coding with
OSC/liblo.

I assume the callbacks I provide to NSM are not called from the main
thread of my program but from nsmd?

At least I don't know how it could be otherwise... But I don't see any
evidence backing this view up in jackpatch or azr3.

Unless thread sync is taken care of within liblo/OSC or something?

Thanks for any enlightenment!

James
J. Liles
2012-07-05 16:32:49 UTC
Permalink
Post by James Morris
Hi,
I'm using the API provided by nsm.h and have no experience coding with
OSC/liblo.
I assume the callbacks I provide to NSM are not called from the main
thread of my program but from nsmd?
At least I don't know how it could be otherwise... But I don't see any
evidence backing this view up in jackpatch or azr3.
Unless thread sync is taken care of within liblo/OSC or something?
Thanks for any enlightenment!
If you use the nsm_init() call, then you will be polling for messages in
whichever thread you like (probably your UI thread). If you use the
nsm_init_thread() call, then you will have created a new thread for message
listening can are required to do your own synchronization (with the UI or
other threads) in your handlers. OSC has nothing to do with it... The same
is true with LASH etc. Usually nsm_init(), and polling in the UI thread
with nsm_check_nowait() in your GUI toolkit's event loop is the simplest
approach.
James Morris
2012-07-06 01:09:17 UTC
Permalink
Post by J. Liles
If you use the nsm_init() call, then you will be polling for messages
in whichever thread you like (probably your UI thread). If you use the
nsm_init_thread() call, then you will have created a new thread for
message listening can are required to do your own synchronization
(with the UI or other threads) in your handlers. OSC has nothing to do
with it... The same is true with LASH etc. Usually nsm_init(), and
polling in the UI thread with nsm_check_nowait() in your GUI toolkit's
event loop is the simplest approach.
Thanks for clarifying that. Another question now...

Does the path given to an NSM client ever have a trailing / on it?
Could it be made to?

Thanks again,
James.

Loading...