| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Threads and classes |
JdBP> class Thread {
JdBP> protected:
JdBP> virtual void main ( void ) = 0 ;
JdBP> void begin ( unsigned long ) ;
JdBP> } ;
Thank you for your answer. I didn't follow your answer exactly, but I got
the idea from it. I just created a dummy-function run() which calls the
real thread-function. I can't see why I didn't think of that myself.
I already got it to work by making the function which had to be started as
a thread a friend-function, and passing the this-pointer to it. But this
way the thread-function isn't really private anymore ( it isn't part of the
class, so it can be called by any function ) and I have to specify the
this-pointer everytime I access one of the class-members.
Now the only problem left is that in the thread-function, I have some parts
which are repeated often, so they would better fit in a function. But since
I would have to use some private members in those functions, I would have
to make them class members ( or friends ). I don't want that if possible,
since those functions don't really belong to the class, only to the
thread-function.
But I don't think there is a good solution for this ( except passing the
needed values to the function, but then I get so many parameters that it
isn't really worth the trouble anymore ).
Regards, Ruud
--- timEd/2 1.00
* Origin: The OS/2 based RS point system (2:280/804.2054)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 712/353 515 713/888 800/1 @PATH: 280/804 801 24/24 396/1 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™.