[Nice] what threads are needed?

Youness Alaoui youness.alaoui at collabora.co.uk
Mon Aug 30 14:47:57 PDT 2010

On 08/30/2010 05:43 PM, Tony Di Croce wrote:
> In the "test-thread.c" example application that is included in the
> libnice source tree a number of threads are created...
> My current thinking is that "lthread" and "rthread" are needed to
> implement the main loop of the agents themselves... IE.. The threads
> that execute the "candidate-gathering-done" etc signals...
> I'm less sure about "ldthread" and "rdthread".... These seem to be used
> when you're attaching a recv function... So I'm guessing these are
> internal worker threads that actually do the data transfer between
> endpoints? If so, do you need a thread like this per stream or is one
> worker thread for the whole agent sufficient?
>     td

No threads are needed, The test-thread.c example is for "testing threads", it's
there to make sure that even if libnice is being used by a multi-threaded
environment, the library is thread-safe. It does not mean at all that you need
to be using threads in order to make it work.. you only need one thread, your
main one, the one where your main_loop is running, that's why you give the
nice_agent_new the main_context to your mainloop, and that's why you give it to
the nice_agent_attach_recv. That's all you need.

p.s: Please keep asking your questions on the mailing list.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/nice/attachments/20100830/f578f2c7/attachment.pgp>

More information about the Nice mailing list