| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Multithread and Watcom C/C++ 10.0 |
A creature called Peter Fitzsimmons screamed at Mike Stella:
MS> Hello... I'm having a little problem with building
MS> a multithreaded application in Watcom C/C++ 10.0. I'm
PF> Here's a tiny program that works. If you are still having
PF> trouble,please post your code & compile options.
Okay, it still gives me a trap. Here's the code:
compile_options = /hw /d2 /zq /otexan /4r /fp3 /fpi87 /bm
#define INLC_NOPM
#define INCL_KBD
#define INCL_VIO
#define INCL_DOS
#define INCL_DOSQUEUES
#define INCL_DOSPROCESS
#include
#include
#include
#include
#include "inp.h"
#include "gfx.h"
HFILE ReadKbd;
HFILE WriteKbd;
void KbdStart()
{
if (DosCreatePipe(&ReadKbd,&WriteKbd,4096))
{
VioWrtTTY("\nError - Could not create recieve pipe in
KbdStart()\n",53,0);
DosExit(1,1);
}
printf("\nbegin");
fflush(stdout);
_beginthread(KbdHandler,NULL,0x200,1); // Here's where it traps
printf("donebegin");
fflush(stdout);
}
void KbdHandler(void *t)
// The Keyboard handler thread
{
KBDKEYINFO ki;
char buf[1];
ULONG num;
for(;;)
{
//VioWrtTTY("kbdhandler",10,0);
printf("kbdhandler");
fflush(stdout);
KbdCharIn (&ki,1,0);
if (ki.chScan != 0)
{
if (ki.chChar == 0)
{
switch (ki.chScan)
{
break;
}
}
else
{
buf[0]=ki.chChar;
if (DosWrite(WriteKbd,buf,1,&num))
{
DosExit(1,1);
}
}
}
else
DosSleep(250); // make the thread sleep for 250ms
}
}
Some stuff has been removed, stuff that won't make a difference, because
it never gets to the thread anyways.
Thanks for the help...
.\\ike Stella
--- ShadowMail/2 1.00
* Origin: Shadowland/2 - USR DS V.34 - 203.456.1103 (1:327/138)SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430 SEEN-BY: 711/807 808 809 934 942 949 955 712/515 713/888 800/1 7877/2809 @PATH: 327/138 469 451 324/288 3615/50 229/2 12/2442 711/409 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™.