| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | EMX strtok bug! |
MS> Hey, could you post your code that gets those threads running? I'm
MS> trying to do the exact same thing but my program keeps traping when it
MS> hits the _beginthread line. I even tried DosCreateThread, but no luck
MS> there either. Thanks...
Getting them started is easy, the biggest problem I've had is not allocating
enough stack space, you'll get a SYSxxxx error telling you if you run out,
just increase it if needed. That's the third arg to _beginthread().
Here's an example of how I am doing it.
#define INCL_BASE
#include
#include
#include
#include
#include
VOID Thread1 (void);
ULONG Global_Done;
void main(INT ArgCount, CHAR **ArgVars)
{
int Thd1_Tid;
ULONG i = 0;
Global_Done = 0;
Thd1_Tid = _beginthread( (void *)Thread1, NULL, 16384, NULL );
while( !Global_Done ) {
printf( "\nPress \'Q\' to quit [%ld]\n", i++ );
if( toupper( getch() ) == 'Q' )
Global_Done = 1;
DosSleep(10);
}
}
VOID Thread1()
{
ULONG i = 0;
printf("\n");
while( !Global_Done ) {
printf( "\rThread1 [%ld]", i++ );
DosSleep(5);
}
_endthread();
}
Phil
--- Blue Wave/Max v2.20m OS2 Beta
* Origin: Crown Point (1:124/6108.2)SEEN-BY: 105/42 620/243 624/50 711/401 409 410 413 430 807 808 809 934 955 SEEN-BY: 712/407 515 628 704 713/888 800/1 7877/2809 @PATH: 124/6108 1014 1 396/1 3615/50 105/103 42 712/515 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™.