www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - multi thread

↑ ↓ ← Michael <Michael_member pathlink.com> writes:
How can I compile a multi thread program? Like this:

#include <cstdio>
#include <process.h>
void thread1(void* pVoid)
{
for(int i = 0; i < 100; i++)
printf("thread1\n");
}

void thread2(void* pVoid)
{
for(int i = 0; i < 50; i++)
printf("thread2\n");
}

int main()
{
_beginthread(thread1, 0, 0);
_beginthread(thread2, 0, 0);
return 0;
}

When compiling: dmc multithread
it prints:
_beginthread(thread1, 0, 0);
^
Error: undefined identifier '_beginthread'
errorlevel 1
May 14 2005
↑ ↓ "Walter" <newshound digitalmars.com> writes:
_beginthread is defined in \dm\include\process.h. I'd check your INCLUDE and
other settings to see if perhaps you've got another process.h somewhere that
is being #include'd instead.
May 17 2005
↑ ↓ → Michael <Michael_member pathlink.com> writes:
In article <d6ea69$16t6$2 digitaldaemon.com>, Walter says...
_beginthread is defined in \dm\include\process.h. I'd check your INCLUDE and
other settings to see if perhaps you've got another process.h somewhere that
is being #include'd instead.

but the problem remained. By the way, does dmc compile the source code into a multithread program by default? No flags needed?
May 20 2005