<s>
The	O
beginthread	B-Operating_System
function	O
creates	O
a	O
new	O
thread	B-Operating_System
of	I-Operating_System
execution	I-Operating_System
within	O
the	O
current	O
process	O
.	O
</s>
<s>
It	O
is	O
part	O
of	O
the	O
Microsoft	B-Application
Windows	I-Application
runtime	B-Library
library	I-Library
and	O
is	O
declared	O
in	O
the	O
process.h	B-Language
header	B-Language
file	I-Language
.	O
</s>
<s>
Thread	B-Operating_System
execution	O
starts	O
at	O
the	O
beginning	O
of	O
the	O
function	O
func	O
.	O
</s>
<s>
To	O
terminate	O
the	O
thread	B-Operating_System
correctly	O
,	O
func	O
must	O
call	O
_endthread	O
or	O
end	O
with	O
"	O
return	O
0	O
"	O
,	O
freeing	O
memory	O
allocated	O
by	O
the	O
run	O
time	O
library	O
to	O
support	O
the	O
thread	B-Operating_System
.	O
</s>
<s>
The	O
operating	O
system	O
allocates	O
a	O
stack	O
for	O
the	O
thread	B-Operating_System
containing	O
the	O
number	O
of	O
bytes	O
specified	O
by	O
stack_size	O
.	O
</s>
<s>
If	O
the	O
value	O
of	O
stack_size	O
is	O
zero	O
,	O
the	O
operating	O
system	O
creates	O
a	O
stack	O
the	O
same	O
size	O
as	O
that	O
of	O
the	O
main	O
thread	B-Operating_System
.	O
</s>
<s>
Returns	O
the	O
operating	O
system	O
handle	O
of	O
the	O
newly	O
created	O
thread	B-Operating_System
.	O
</s>
<s>
If	O
unsuccessful	O
,	O
the	O
function	O
returns	O
-1	O
and	O
sets	O
errno	B-Error_Name
.	O
</s>
<s>
To	O
compile	O
a	O
program	O
using	O
multiple	O
threads	B-Operating_System
with	O
the	O
Microsoft	O
C/C	O
++	O
Compiler	O
,	O
you	O
must	O
specify	O
the	O
/MT	O
switch	O
(	O
or	O
/MTd	O
,	O
for	O
debug	O
programs	O
)	O
.	O
</s>
