Re: [gmime-devel] thread safety and g_mime_init()

Title: thread safety and g_mime_init()
Hi again Junping,

Just wanted to let you know that I've released 2.4.28 (I made a 2.4.27 release last night but missed GMimeDataWrapper and another fix needed for someone else).

Happy hacking!


On 11/05/2011 01:47 PM, Jeffrey Stedfast wrote:
On 10/21/2011 12:17 PM, Junping Zhang wrote:

Hi, there,

  In my code, I call g_mime_init() at the start of the process, and then spawn multiple threads to do the parsing with code like this

    fd = open(...)

    gm_stream = g_mime_stream_fs_new(fd);
    gm_parser = g_mime_parser_new_with_stream(gm_stream);

    gm_msg = g_mime_parser_construct_message(gm_parser);

  Once in a while I got
    (process:2547): GLib-GObject-WARNING **: cannot register existing type `GMimeFilterBasic'

  I realized that there is a race condition in g_mime_stream_fs_get_type() which is called from g_mime_stream_fs_new(). If both threads got there at the same time and both got type 0, we would get the above warning. I believe this part of the code is the same in 2.4 through current 2.6.

Yes, it likely is. And you are right about what is happening.

  I thought g_mime_init() should initialize this type by calling g_mime_stream_fs_get_type() as it does for some other types, and I wonder what is the reason not to include some of the types and what should be the recommended calling sequence here.

No reason but lazyness, I'm afraid. I'll fix this up for 2.4.27 and 2.6.1.


_______________________________________________ gmime-devel-list mailing list gmime-devel-list gnome org

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