No it doesn't need to be static
, just make it a member in your classA
and also you can take a look at QMutexLocker to scope lock and unlock the mutex:
void classA::Append(int _msg)
{
static int c = 0;
QMutexLocker locker(&mutex); // mutex is a QMutex member in your class
intArray[c] = _msg;
c++;
/*mutex.unlock(); this unlock is not needed anymore, because QMutexLocker unlocks the mutex when the locker scope ends, this very useful especially if you have conditional and return statements in your function*/
}