I'm currently trying to port a remake of Bagman, but ran into an issue (probably a simple one):
That function:
CNT &find_or_create()
{
const ThreadId myid = me();
cs_start();
typename ContainerType::iterator rval = m_map.find(myid.p);
if (rval == m_map.end())
{
// not found (first call to get() from this thread): create one
// in thread safe mode (list is shared by all threads)
std:
air<typename ContainerType::iterator, bool> success =
m_map.insert(make_pair(myid.p,CNT()));
// update size while in thread protected context
m_size = m_map.size();
rval = success.first;
}
cs_end();
return rval->second;
}
spits out the following error:
That function:
CNT &find_or_create()
{
const ThreadId myid = me();
cs_start();
typename ContainerType::iterator rval = m_map.find(myid.p);
if (rval == m_map.end())
{
// not found (first call to get() from this thread): create one
// in thread safe mode (list is shared by all threads)
std:
m_map.insert(make_pair(myid.p,CNT()));
// update size while in thread protected context
m_size = m_map.size();
rval = success.first;
}
cs_end();
return rval->second;
}
spits out the following error:
Code:
src/sys/ThreadSafeContainer.h: In member function 'CNT& ThreadSafeContainer<CNT>::find_or_create()':
src/sys/ThreadSafeContainer.h:93:58: error: request for member 'p' in 'myid', which is of non-class type 'const ThreadId {aka const long unsigned int}'
typename ContainerType::iterator rval = m_map.find(myid.p);
^
src/sys/ThreadSafeContainer.h:101:34: error: request for member 'p' in 'myid', which is of non-class type 'const ThreadId {aka const long unsigned int}'
m_map.insert(make_pair(myid.p,CNT()));
^