title: Working around invalid conversion from const
body: <p>I am compiling Percona (MySQL variant) on my Raspberry Pi, which has an ARM processor.</p>
  
  <p>I've encountered an issue during compilation that has been reported, but nobody is willing to fix because ARM is an unsupported platform.</p>
  
  <p><a href="https://bugs.launchpad.net/percona-server/+bug/1002848" rel="noreferrer">https://bugs.launchpad.net/percona-server/+bug/1002848</a></p>
  
  <p>I've managed to work around the issue and successfully compile, but my knowledge of c++ is somewhat lacking and I don't fully understand if I have actually broken something or not.</p>
  
  <p>I've read through lots of the invalid conversion from const char* to char* questions on SO, which is where I got the idea for this workaround.</p>
  
  <p>The error was as follows:</p>
  
  <pre><code>error: invalid conversion from 'const pthread_mutex_t*' to 'pthread_mutex_t*'
  </code></pre>
  
  <p>(it actually wasn't <code>pthread_mutex_t</code> on my platform, but the issue is the same - actual type lost to the infinite abyss that is the scrollback buffer)</p>
  
  <p>The offending code was:</p>
  
  <pre><code>  uint32 count(uint index) const
    {
      my_atomic_rwlock_rdlock(&amp;time_collector_lock);
  </code></pre>
  
  <p>I changed this to:</p>
  
  <pre><code>  uint32 count(uint index) const
    {
      my_atomic_rwlock_t dummy = time_collector_lock;
      my_atomic_rwlock_rdlock(&amp;dummy);
  </code></pre>
  
  <p>time_collector_lock is defined as:</p>
  
  <pre><code>private:
    my_atomic_rwlock_t time_collector_lock;
  </code></pre>
  
  <p>Due to the fact this is supposed to be a mutex, I have a feeling I've probably made this non-thread-safe. Or is this ok?</p>
  
  <p>Is there a better solution?</p>