dinhviethoa/libetpan — pull request #101 by chacham15 (2014-01-11 22:55:20+00:00)
Title: added native windows threading support

I wanted to compile libetpan under mingw and not use the mingw-pthread library so I implemented all the changes necessary. The only thing that I am a bit uncertain about (although in practice it seems to work fine) is a result of the lack of a static initializer in windows of a mutex. Therefore, I added some initialization stuff in mailstream_ssl.c at mailstream_ssl_init. The code itself will run initialization only in one thread. The only problem is that if two threads run it simultaneously, the thread that did not do the initialization might continue on to use the thread primitives while they are being initalized by the other thread. Naturally, this is only a problem for this compilation of windows, but so far I see no problem. If you have any ideas of how to fix that minor problem I would be grateful. In any case, the changes I have made here do seem to work for mingw with native windows threads if you would like to import back to the main branch.