Threaded class within another class

Is it possible to create an instance of a threaded class within a custom class, or does it have to be under the ofApp?

I use ofxCv to train a face recognition model. I regularly need to update the model while the application is running, so I need to put the model->train() function to different thread to prevent interrupting the rest of the application.

Some basic code in ThreadedModel.h

#pragma once

#include "ofMain.h"
#include "ofxCv.h"
#include "ofxOpenCv.h"
#include "ofThread.h"

using namespace ofxCv;
using namespace cv;

class ThreadedModel : public ofThread {
	void setup() {
		this->model = createEigenFaceRecognizer(80, 5000);

	void threadedFunction() {


	Ptr<FaceRecognizer> model;
	vector<Mat> modelFaces;
	vector<ofImage> modelOfFaces;
	vector<int> modelLabels;


If I add the class in my app.h the application runs fine

#include "ThreadedModel.h"

class ofApp : public ofBaseApp {
ThreadedModel threadedModel;

But if I move it in a a class called manager.h which is responsible for all the images and eventually the model, I get this error at the ofApp point where I construct the manager:

1>src\ofApp.cpp(24): error C2280: 'manager &manager::operator =(const manager &)': attempting to reference a deleted function
1>  d:\mystuff\ch3\dev\visual studio 2015\of_v0.9.8_vs_release\apps\myapps\we\src\manager.h(82): note: compiler has generated 'manager::operator =' here

Any ideas?
This is the first time I attempt to use threading so I may be missing something fundamental.


I modified the thread example and added a basic class and I get the same error when I try to include a threadedObject within the class.

Should I assume that’s a general limitation?

no, not sure what’s the problem but you should be able to use this from anywhere.The problem you point out happens when you try to copy a class that has a thread or a mutex, perhaps you are putting it in a vector?