another directory rename: failstar -> fail

"failstar" sounds like a name for a cruise liner from the 80s.  As "*" isn't a
desirable part of directory names, just name the whole thing "fail/", the core
parts being stored in "fail/core/".

Additionally fixing two build system dependency issues:
 - missing jobserver -> protomessages dependency
 - broken bochs -> fail dependency (add_custom_target DEPENDS only allows plain
   file dependencies ... cmake for the win)


git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@956 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-03-08 19:43:02 +00:00
commit b70b6fb43a
921 changed files with 473161 additions and 0 deletions

View File

@ -0,0 +1,75 @@
// Map class that has thread synchronisation
// TODO We should consider to use Aspects for synchronisation primitives..
#ifndef __SYNCHRONIZED_MAP_HPP__
#define __SYNCHRONIZED_MAP_HPP__
#include <map>
#ifndef __puma
#include <boost/thread.hpp>
#endif
template <typename Tkey, typename Tvalue>
class SynchronizedMap
{
private:
typedef std::map< Tkey, Tvalue > Tmap;
typedef typename Tmap::iterator Tit;
Tmap m_map; // Use STL map to store data
#ifndef __puma
boost::mutex m_mutex; // The mutex to synchronise on
#endif
public:
int Size(){
#ifndef __puma
boost::unique_lock<boost::mutex> lock(m_mutex);
#endif
return m_map.size();
}
/**
* Add data to the map, return false if already present
* @param key Map key
* @param value value according to key
* @return false if key already present
*/
bool insert(const Tkey& key, const Tvalue& value )
{
// Acquire lock on the queue
#ifndef __puma
boost::unique_lock<boost::mutex> lock(m_mutex);
#endif
if( m_map.find(key) == m_map.end() ){ // not present, add it
m_map[key] = value;
return true;
}else{ // item is already in, oops
return false;
}
} // Lock is automatically released here
/**
* Remove value from the map.
* @param key The Map key to remove
* @return false if key was not present
*
*/
bool remove(const Tkey& key, Tvalue& value)
{
// Acquire lock on the queue
#ifndef __puma
boost::unique_lock<boost::mutex> lock(m_mutex);
#endif
Tit iterator;
if ( (iterator = m_map.find(key)) != m_map.end() ) {
value = iterator->second;
m_map.erase(iterator);
return true;
}else{
return false;
}
} // Lock is automatically released here
};
#endif