Sorry if this is off topic.
Thanks for the info.
Steve
--
Arnold Hendriks <a.hen...@b-lex.com>
B-Lex Information Technologies, http://www.b-lex.com/
Are you programming in C/C++? If so...
Both are totally brain-damaged! Instead, use pthread_create():
http://sources.redhat.com/pthread-win32
regards,
alexander.
P.S. And don't miss cond.vars and other pthreads stuff too! ;-)
Oops! I meant: http://sources.redhat.com/pthreads-win32
_beginthreadex() will also give you a thread, but it will do some extra
work so the runtime knowns you are working with threads - which eliminates
the problems CreateThread() might introduce.
It is a little like the difference between compiling a unix program using
threads with the -DREENTRANT flag and compiling the same program w/o that
flag. There are alot of short articles about this, and I think there are
even one or two in the MSDN but I could be mistaken.
I did a little research (I know I should have done that first) and
found an old posting, which refers to this issue. The post provides
this advice:
> In short, _beginthread/_exitthread pair for c programs that are say console
> apps that are basic and use the c-runtime lib/dll. If it's a real Win32
> app, use Win32 API's and stay away from the c-runtime. Hope this clears it
> up somewhat.
Even the MSDN section “Writing Multithreaded Win32
Programs” refers to _beginthread (including their Bounce
example). I don’t think Bounce is a Win32 program (looks like a
console program).
Any other advice on this topic? I think there is also an MFC version
of thread control, isn’t there?
Steve
[...MSDN/Writing Multithreaded Win32 Programs/Bounce/MFC...]
> Any other advice on this topic?
YES:
http://groups.google.com/groups?as_umsgid=c29b5e33.0201240004.57d109f4%40posting.google.com
regards,
alexander.
% CreateThread() will give you a thread, but won't do anything to let the
% rest of the c runtime know your using a thread - so the parts that aren't
% thread aware in the runtime will get screwed up unless you are very
% careful about what you're doing.
This is a bit of a mis-statement. If you use the MS C run-time and start
a thread with CreateThread(), you may have memory leaks when the thread
exits. Being careful won't help with this, unless you're careful enough
to avoid using the C run-time.
Having said that, it's probably best to assume what Crahen says is
strictly true, up until the word `unless'.
--
Patrick TJ McPhee
East York Canada
pt...@interlog.com
HTH,
Justin Michel
OCI
It is the parts that _are_ thread-aware that will become screwed up.