Problem about initialize a mutex object in a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,
I've been recently writing a thread based library with pthread on Linux.
I've got a class like this:

class Thread
{
private:
 pthread_mutex_t thread_mutex;
public:
 Thread();
}

Thread::Thread() : thread_mutex(PTHREAD_MUTEX_INITIALIZER)
{
}

But when I'm compiling the code. g++ told me:
error: expected primary-expression before '{' token

My g++ version is  4.1.2.
I can't initialize a struct that way. Right?
Since it's the only place I can use to initialize a struct.

Thanks for any help.
Regards

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux