c++ member function thread safe
<p>I am writing a function for logging messages .
I will be calling this print function from different threads .
My code is as follows :</p>

<pre><code>MyLog::printLog(const char* s)
    {

            std::string myline(s);
            //m_Mutex is class member and there will be only object for this class
            // shared by all threads
            int ret = pthread_mutex_lock(&amp;m_Mutex);
            if ( ret != 0 )
            {
                    std::cout&lt;&lt;" trying to lock same mutex char* "&lt;&lt;std::endl;

            }


            //code to log message in File

            pthread_mutex_unlock(&amp;m_Mutex);
     }
</code></pre>

<p>My question is if above function is called from different threads with argument like "from thread1" , "from thread 2" ,... will there be any chance const char *s will be jumbled up  printing wrong values .?
I hope my question is clear . </p>
