Jump to content

ACE_RW_Thread_Mutex question


amaru

Recommended Posts

Hello!

I modifier LooItem struct in LooItem.h and added ACE_RW_Thread_Mutex in it.

http://paste2.org/p/1966439

This makes compile fail with error

2>c:\\core_temp\\test-zone\\code\\dep\\ACE_wrappers\\ace/RW_Thread_Mutex.h(63) : error C2248: 'ACE_RW_Mutex::operator =' : cannot access private member declared in class 'ACE_RW_Mutex'

2> c:\\core_temp\\test-zone\\code\\dep\\ACE_wrappers\\ace/RW_Mutex.h(127) : see declaration of 'ACE_RW_Mutex::operator ='

2> c:\\core_temp\\test-zone\\code\\dep\\ACE_wrappers\\ace/RW_Mutex.h(42) : see declaration of 'ACE_RW_Mutex'

2> This diagnostic occurred in the compiler generated function 'ACE_RW_Thread_Mutex &ACE_RW_Thread_Mutex::operator =(const ACE_RW_Thread_Mutex &)'

The reason for this is that it tries to initialize instance of ACE_RW_Mutex, but is has private constructor, so it fails.

Question - why? There are so many ACE_RW_Thread_Mutex'es in code (HashMapHolder, TerrainMgr, etc) but there are no such errors.

Link to comment
Share on other sites

If mutex need only for original LootItem structure then you can overwrite operator= or LootItem(LootItem const&) to proper way avoid copy mutet (create new in new struct copy. Also i not look but possible LootItems stored as value in storage container and then copy constructor can called when container grow/etc.

But posible most correct answer: you add mutex to wrong type when it not expected and wrong placed for any uses.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use