Boost logo

Boost Users :

Subject: [Boost-users] [mutex] Error in static method
From: Daniele Barzotti (daniele.barzotti_at_[hidden])
Date: 2010-03-29 03:53:54


Hi,

I have a class which defines a static callback:

--------------------------------------------------------------
class CDeviceManager
{
  private:

    struct TCallbackUserData
    {
      CDeviceManager* ptrThis;
      INT CurrentApi;
    };

    // Since the callback is static, I need this struct to pass data
    TCallbackUserData CBUserData_;
    boost::mutex Mutex_;
};

INT CDeviceManager::audio_callback(void *outputBuffer,
                                   void *inputBuffer,
                                   UINT nBufferFrames,
                                   double streamTime,
                                   RtAudioStreamStatus status,
                                   void *userData )
{
  CDeviceManager* This = 0;

  TCallbackUserData* UserData = (TCallbackUserData*)userData;
  This = UserData->ptrThis;

  // Used if the audio device is opened with simultaneous API
  boost::lock_guard<boost::mutex> lock(This->Mutex_);

}
--------------------------------------------------------------

But on compiling I get:

1>d:\lib\boost_1_42_0\boost\thread\win32\mutex.hpp(38) : error C2248:
'boost::noncopyable_::noncopyable::operator =' : cannot access private
member declared in class 'boost::noncopyable_::noncopyable'
1> d:\lib\boost_1_42_0\boost\noncopyable.hpp(28) : see
declaration of 'boost::noncopyable_::noncopyable::operator ='
1> d:\lib\boost_1_42_0\boost\noncopyable.hpp(22) : see
declaration of 'boost::noncopyable_::noncopyable'
1> This diagnostic occurred in the compiler generated function
'boost::mutex &boost::mutex::operator =(const boost::mutex &)'

I know that the mutex is noncopyable, but I use this many times.
It depends by the 'static' method?

Regards,
Daniele.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net