Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8236

Re: simple pthread

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: simple pthread
Date 2011-07-26 19:41 +1200
Message-ID <9979d6FkjuU13@mid.individual.net> (permalink)
References <34eba984-d360-46c0-a5ec-71abf8c1ee00@glegroupsg2000goo.googlegroups.com> <996v46FkjtU2@mid.individual.net> <1f8bd996-7f31-4e5b-85c6-28325d00a7b6@f17g2000prf.googlegroups.com> <8d4f7$4e2e5a25$506c0d9c$24252@news.chello.at> <5407c353-b2c4-4684-b94e-9a24c117f587@u28g2000prm.googlegroups.com>

Show all headers | View raw


On 07/26/11 06:15 PM, cerr wrote:
> On Jul 25, 11:09 pm, Paul Brettschneider
> <paul.brettschnei...@yahoo.fr>  wrote:
>> cerr wrote:
>>>> It looks like you missed my other comments, go be back and check, 'void'
>>>> isn't a valid parameter value and a member function isn't a valid thread
>>>> function.
>>
>>> Alright, so how can I pass no parameter then, NULL or (void) NULL
>>> don't work either...
>>> So I cannot have a thread in a class? Alright then...would a different
>>> class by okay or does it need to be global?
>>
>> It's probably not standards conformant, but under g++ you can use static
>> member functions as argument to pthread_create. Pass this as the void*
>> argument parameter. In the static member function reinterpret_cast<>  to your
>> class and call a real member function from this pointer.
>>
>> You could for example implement this in a Thread-class with a pure virtual
>> doit() function.
> Alright, I wanna stick with standard c++ for this. But i'm still not
> sure how
> I can have the argument being void....anyone?

The parameter type is void*, not void.  Pass NULL.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: simple pthread cerr <ron.eggler@gmail.com> - 2011-07-25 21:15 -0700
  Re: simple pthread Ian Collins <ian-news@hotmail.com> - 2011-07-26 16:45 +1200
    Re: simple pthread cerr <ron.eggler@gmail.com> - 2011-07-25 22:54 -0700
      Re: simple pthread Paul Brettschneider <paul.brettschneider@yahoo.fr> - 2011-07-26 08:09 +0200
        Re: simple pthread cerr <ron.eggler@gmail.com> - 2011-07-25 23:15 -0700
          Re: simple pthread Ian Collins <ian-news@hotmail.com> - 2011-07-26 19:41 +1200
          Re: simple pthread Paul Brettschneider <paul.brettschneider@yahoo.fr> - 2011-07-26 17:35 +0200

csiph-web