🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #7707

pthread vanuit C++ class

#7707
From: Degrande Jeffrey
Date: Mon, 05 Aug 2002 08:41
46 lines
1761 bytes
hoi,

ik wil vanuit de constructor van een class een aantal memberfuncties in 
aparte threads laten lopen.  Ik kom er echter niet helemaal uit.

Ideaal zou zijn als ik iets zou kunnen doen als (voorbeeldje)

#include <pthread.h>
Class blaat
{
        
        public:
                blaat();
                ~blaat();
                void *capture( void *);
                void *write (void *);
}

//.cpp
#include "blaat.h"
blaat::blaat() {
        pthread_t tCAP;
        pthread_t tWRI;
        
        pthread_create ( &tCAP, NULL, &capture, NULL );
        pthread_create ( &tWRI, NULL, &write, NULL); 

        // ...
}

void * blaat::capture( void *) {
        //bla bla bla
}

void * blaat::write( void * ) {
        //bla bla bla
}
        


Werkt echter aan geen kanten.  Iemand een suggestie/idee/voorbeeld hoe je 
iets dergelijks deftig aanpakt?


mvg,
Degrande Jeffry
Technical Details
Message-ID: <3d4e3a84$0$223$ba620e4c@news.skynet.be>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!iad-peer.news.verio.net!news.verio.net!skynet.be!skynet.be!louie!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,e7fe71dcab527929,start
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2002-08-05 01:48:22 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!iad-peer.news.verio.net!news.verio.net!skynet.be!skynet.be!louie!not-for-mail
Message-ID: <3d4e3a84$0$223$ba620e4c@news.skynet.be>
From: Degrande Jeffrey <jeffrey@rwt.be>
Subject: pthread vanuit C++ class
Newsgroups: be.comp.programming
Date: Mon, 05 Aug 2002 10:41:57 +0200
Organization: RWTronic
User-Agent: KNode/0.7.1
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Lines: 46
NNTP-Posting-Host: 217.136.228.115
X-Trace: 1028536964 reader1.news.skynet.be 223 217.136.228.115
X-Complaints-To: abuse@skynet.be