| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Com Device Programming |
JL>There's obviously stuff missing, like a flag to indicate that the thread JL>is already running or a way to tell the thread to quit... but JL>it should give you the basic idea... the only real problem JL>is that _beginthread() and DosCreateThread() are both want JL>the thread function to be 'C' and won't take a class-member JL>method as a paramater... so you've got to fake 'em out by JL>passing a static member or using an external 'C' helper JL>function. I asked around in the C++ echo a while back, and JL>the former method (using a static member) was by far the JL>most popular solution... FWIW. RC> How about other OS/2 API calls? What I'd like to do is have a thread RC>class that installs an exit handler via the DosExitList() function so that RC>I can have multiple instances of that class that each have their own exit RC>list handler. Is this doable? All C++ functions called by C functions (including OS/2 API) must not be not non-static class members. The reason is that non-static class members expect to get passed a hidden parameter, this, which identifies the object that is being referred to. C doesn't understand this concept of hidden parameters, and thus it won't work. (ie C would use function(), where C++ you would use pointer->function(), to call a non static member function) It may be possible though for a static member function to call a non static member function, if you can somehow derive the address of the object yourself, and call pointer->exit(); (or what ever you call the routine). It depends on your application. I fact Windowing C++ classes do just this. An example that I have seen stores the this pointer as a window word, and retrives it based on the window handle whenever the window procedure is called. (as shown in the "OS/2 Developer" magazine). RC> Thanks, cya. RC> I hope this helps, Brian May ___ * MR/2 2.03 NR * Prosecutors will be violated --- Maximus/2 2.01wb* Origin: Multi - 61-3-739-7145 (3:633/363) SEEN-BY: 12/2442 54/54 620/243 624/50 632/301 341 348 365 386 998 633/104 252 SEEN-BY: 633/260 357 363 371 373 379 634/384 635/210 502 503 636/100 638/100 SEEN-BY: 640/820 690/660 711/409 410 413 430 807 808 809 934 712/353 623 SEEN-BY: 713/888 800/1 @PATH: 633/363 260 371 635/503 632/348 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™.