| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | thread behaviour |
Hallo,
I've been fighting my c-compiler again and this time with threads... And
got a very strange thing:
#define INCL_DOSPROCESS
#define INCL_NOPMAPI
#define INCL_BASE
#define STACK_SIZE 1024
#include
#include
#include
#include
#include
#include
void main(void)
{
ULONG stkptr;
void thread1(),thread2();
TID thread1ID,thread2ID;
unsigned rc;
stkptr=(ULONG)malloc(STACK_SIZE)+STACK_SIZE;
rc=DosCreateThread(&thread1ID,(PFNTHREAD)thread1,0,0,stkptr);
printf("threadID: %d\n",thread1ID);
if (rc)
{
printf("Error creating thread (%u)\n",rc);
exit(1);
}
stkptr=(ULONG)malloc(STACK_SIZE)+STACK_SIZE;
rc=DosCreateThread(&thread2ID,(PFNTHREAD)thread2,0,0,stkptr);
printf("threadID: %d\n",thread2ID);
if (rc)
{
printf("Error creating thread (%u)\n",rc);
exit(1);
}
while (!kbhit())
printf("X");
exit(0);
}
void thread1(void)
{
while (TRUE)
printf("-");
}
void thread2(void)
{
while (TRUE)
printf("+");
}
Well, this thing prints a +, - or X. But... when I'm running this
program and press pause and the any key, I only get the +, - or X and
nothing else. This goes on until I've pressed alt-esc or ctl-esc. Is
this normal?
Edwin
/\/\ /\ \/!
...Nurses prefer undressed hackers.
--- FNNR 17+
* Origin: MavEtJu rules! (2:284/205.1)SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413 SEEN-BY: 711/430 807 808 809 934 712/353 623 713/888 800/1 @PATH: 284/205 2 1 280/0 801 24/24 396/1 3615/50 229/2 12/2442 @PATH: 711/409 54/54 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.