I am trying to create a new stream with the CameraManager class, but I have the following error:
cannot convert '* void (CameraManager :: *) (void *) to void * (*) (void *) into the pthread_create function
i defined in cameramanager.h:
public:
void *dequeueLoop(void *ptr);
and in cameramanager.cpp
void CameraManager::startDequeuing(){
dequeuing = true;
dequeueThreadId = pthread_create(&dequeueThread, NULL, &CameraManager::dequeueLoop, NULL);
}
void *CameraManager::dequeueLoop(void *ptr){
while(dequeuing){
highSpeedCamera->dequeue();
highSpeedCamera->enqueue();
}
I do not want to declare dequeueLoop as a static function, I also tried to declare dequeueLoop as a function of the friend class as follows, but then it does not have the scope of the highSpeedCamera and 'dequeuing' classes and the compiler also tells me that 'dequeueLoop' was not declared in this area
to make dequeueLoop a friend function that I did:
cameramanager.h
public:
friend void *dequeueLoop(void *ptr);
cameramanager.cpp
void CameraManager::startDequeuing(){
dequeuing = true;
dequeueThreadId = pthread_create(&dequeueThread, NULL, &CameraManager::dequeueLoop, NULL);
}
void *dequeueLoop(void *ptr){
while(dequeuing){
highSpeedCamera->dequeue();
highSpeedCamera->enqueue();
}
}
Where am I doing wrong?