> 
>       In my multiplatform apps, I made the decision to use an #ifdef
>       to resolve threading, using pthreads for unix code, and 
> the win32
>       CreateThread() for Windows, which is very easy to use 
> and works fine.
>       (More than I can say about a lot of other WIN32 API 
> functions..!)
> 
>       I hadn't heard of _beginthread().. interesting. Docs here:
>       http://msdn.microsoft.com/en-us/library/kdzttdcb(VS.80).aspx
> 
>       Note the docs for _beginthread() are recommending
>       to use the safer "_beginthreadex()" which is apparently
>       (trying not to giggle) a 'thread safe' version of that 
> call.. %^D


Yes - I wouldn't bother too much about "_beginthreadex()" to be honest.
It's main "advantage" over the "plain" _beginthread(), as far as I can
see, is that it has the same parameters (give or take some minor casts)
as the older CreateThread() function, so it is fairly easy to drop that
in to old code that used CreateThread() before.

For new code, I would always choose _beginthread() in preference, and it
has the added advantage (from my perspective) of being more like
pthread_create() and thus easier to ifdef into place...

As for CreateThread(), I'd advocate against using it at all. Even the MS
docs recommend against it these days. It seems there are issues with the
way it interacts with the C runtime in threaded apps that can be
"problematic".
Although why they would have a CreateThread API that didn't work in
threaded apps is an interesting question...

That said, I have never knowingly encountered a bug due to
CreateThread() failing to interact correctly with the C runtime, but
when even MS are advising against it... Well, caution to the fore - use
beginthread, I say!
-- 
Ian




SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to