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


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

Re: simple pthread

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: simple pthread
Date 2011-07-26 16:45 +1200
Message-ID <996v46FkjtU2@mid.individual.net> (permalink)
References <34eba984-d360-46c0-a5ec-71abf8c1ee00@glegroupsg2000goo.googlegroups.com>

Show all headers | View raw


On 07/26/11 04:15 PM, cerr wrote:
>> This looks like a mixed up function declaration!
>
> Yep, exactly right... :o
>>
>>
>> int something = pthread_create(  );
>>
>> A decent compiler should tell you that MyThread::PrintMsg is the wrong
>> function type for the function pointer parameter of pthread_create.
>
> I'm using g++ and io got this now:
> int MyThread::StartMe(void)
> {
>    pthread_create(&ThreadA, NULL,&MyThread::PrintMsg, void);
> }
> //-------------------------------------------------------------
> and the compiler tells me:
> $ g++ -o example example.cpp
> example.cpp: In member function ‘int MyThread::StartMe()’:
> example.cpp:42:55: error: expected primary-expression before ‘void’
>
> what is a primary expression in this case? :o
> Thanks,

Firstly, please don't use the sociopathic "new" google interface, it 
ruins threading!.

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.

-- 
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