[libnice] multithread g_main_loop_quit ad remove agent

Emanuele Bizzarri emabiz76 at gmail.com
Mon Jul 14 09:01:54 PDT 2014


On 14/07/2014 14:27, Philip Withnall wrote:
> You can still implement your own reference counting for the user_data.
> If it is a struct, just add a new member:
>      volatile int ref_count;
> and thread-safe ref and unref functions:
>      MyStruct *my_struct_ref (MyStruct *self) {
>          g_atomic_int_inc (&self->ref_count);
>          return self;
>      }
> and:
>      void my_struct_unref (MyStruct *self) {
>          if (g_atomic_int_dec_and_test (&self->ref_count)) {
>              /* Free the structure here. */
>          }
>      }
To implement this I need two points inside the the code runned by the 
main loop thread in which change the reference count and check for 
destruction.
Can I use change state NICE_COMPONENT_STATE_GATHERING to increase ref_count
and
streams-removed to decrease it?
Please give me a suggestion.

Thank you,

Emanuele
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20140714/67ab34f5/attachment-0001.html>


More information about the nice mailing list