Working around invalid conversion from const
===

I am compiling Percona (MySQL variant) on my Raspberry Pi, which has an ARM processor.

I've encountered an issue during compilation that has been reported, but nobody is willing to fix because ARM is an unsupported platform.

[https://bugs.launchpad.net/percona-server/+bug/1002848](https://bugs.launchpad.net/percona-server/+bug/1002848)

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.

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.

The error was as follows:

`error: invalid conversion from 'const pthread_mutex_t*' to 'pthread_mutex_t*'`

(it actually wasn't `pthread_mutex_t` on my platform, but the issue is the same - actual type lost to the infinite abyss that is the scrollback buffer)

The offending code was:

      uint32 count(uint index) const
      {
        my_atomic_rwlock_rdlock(&time_collector_lock);

I changed this to:

      uint32 count(uint index) const
      {
        my_atomic_rwlock_t dummy = time_collector_lock;
        my_atomic_rwlock_rdlock(&dummy);

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?

Is there a better solution?

Many thanks,

Leigh.