title: How to use a std::mutex in a class context
body: <p>i'm having some trouble using a C++11 std::mutex</p>
  
  <p>in my class I have a variable called semaphore of type std::mutex.</p>
  
  <p>So I positioned my semaphore.lock() and semaphore.unlock() before and after my critical section</p>
  
  <pre><code>class Database {
  public:
  Database(string, string, string, string);
  virtual ~Database();
  
  struct sMyHome getMyHome(void);
  struct sPhysical getPhysical(int);
  struct sSystemInfo getSystemInfo(void);
  void commitSystemInfo(struct sSystemInfo);
  struct sTSensors getTSensors(int);
  struct sWireless getWireless(int);
  struct sWirelessConf getWirelessConf(int);
  struct sWirelessStatus getWirelessStatus(int);
  
  private:
  void queryMyHome(void);
  void queryPhysical(int);
  void querySystemInfo(void);
  void queryTSensors(int ID);
  void queryWireless(int ID);
  void queryWirelessConf(int ID);
  void queryWirelessStatus(int ID);
  string toString(int);
  
  struct sMyHome MyHome;
  struct sPhysical Physical[4];
  struct sSystemInfo SystemInfo;
  struct sTSensors TSensors[32];
  struct sWireless Wireless[64];
  struct sWirelessConf WirelessConf[64];
  struct sWirelessStatus WirelessStatus[64];
  
  MYSQL *connection;
  mutex semaphore;
  };
  </code></pre>
  
  <p>this is part of the main, where I retrieve the error:</p>
  
  <pre><code> Database db = Database("192.168.1.10", "****", "******", "******");
  </code></pre>
  
  <p>but the cross-compiler says </p>
  
  <pre><code>../main.cpp:8:73: error: use of deleted function 'Database::Database(const Database&amp;)'
    Database db = Database("192.168.1.10", "root", "raspberry", "DomoHome2");
                                                                       ^
  In file included from ../main.cpp:2:0:
  ../Database.h:79:7: note: 'Database::Database(const Database&amp;)' is implicitly deleted      because the default definition would be ill-formed:
   class Database {
     ^
  ../Database.h:79:7: error: use of deleted function 'std::mutex::mutex(const std::mutex&amp;)'
   In file included from ../Database.h:12:0,
               from ../main.cpp:2:
  /Volumes/rpi-crosscompiler-toolchain/arm-none-linux-gnueabi/arm-none-linux-gnueabi/include/c++/4.8.2/mutex:128:5: error: declared here
   mutex(const mutex&amp;) = delete;
   ^
  make: *** [main.o] Error 1
  </code></pre>
  
  <p>and this is my constructor:</p>
  
  <pre><code>Database::Database(string Address, string Username, string Password, string Database) {
  // TODO Auto-generated constructor stub
  connection = mysql_init(NULL);
  mysql_real_connect(connection, Address.c_str(), Username.c_str(), Password.c_str(), Database.c_str(), 0, NULL, 0);
  }
  </code></pre>