Re: Does glib hash table support multi thread. Is it thread safe hash table.



hi
Thank you for replying. I do not call that function. You mean in main thread call that function? Could you give me some simple example?  I see this function has some thread safe explaination.

g_hash_table_ref ()

Atomically increments the reference count of hash_table by one. This function is MT-safe and may be called from any thread.

hash_table :



On Mon, Sep 20, 2010 at 11:12 PM, Lex Trotman <elextr gmail com> wrote:
On 21 September 2010 12:20, Qingpeng Niu <niuqingpeng gmail com> wrote:
> Hi
>
> #pragma omp parallel for private(i) shared(pdt_a)
>         for(i=0;i<psize;i++)
>                 pdt_a[i]= g_hash_table_new(g_str_hash, compare_strings);
> It gives the following errors. Somebody can help me out of here. How do i
> make this hashtable thread safe?
>
> GLib-ERROR **: gmem.c:154: failed to allocate 137438953456 bytes
> aborting...
>

Did you call g_thread_init?  That should make g_hash_table_new thread safe.

Cheers
Lex

>
> --
> Qingpeng Niu
> Department of Computer Science and Engineering at OSU
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list



--
Qingpeng Niu
Department of Computer Science and Engineering at OSU


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