mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0029960: Foundation Classes - disarm OSD_ThreadPool copy constructor
Private copy constructors have been added to OSD_ThreadPool and Standard_Condition to protect misuse.
This commit is contained in:
@@ -112,6 +112,7 @@ protected:
|
||||
{
|
||||
friend class OSD_ThreadPool;
|
||||
public:
|
||||
//! Main constructor.
|
||||
EnumeratedThread (bool theIsSelfThread = false)
|
||||
: myPool (NULL), myJob (NULL), myWakeEvent (false),
|
||||
myIdleEvent (false), myThreadIndex (0), myUsageCounter(0),
|
||||
@@ -131,6 +132,34 @@ protected:
|
||||
//! Wait the thread going into Idle state (finished jobs).
|
||||
Standard_EXPORT void WaitIdle();
|
||||
|
||||
public:
|
||||
|
||||
//! Copy constructor.
|
||||
EnumeratedThread (const EnumeratedThread& theCopy)
|
||||
: OSD_Thread(),
|
||||
myPool (NULL), myJob (NULL), myWakeEvent (false),
|
||||
myIdleEvent (false), myThreadIndex (0), myUsageCounter(0),
|
||||
myIsStarted (false), myToCatchFpe (false),
|
||||
myIsSelfThread (false) { Assign (theCopy); }
|
||||
|
||||
//! Assignment operator.
|
||||
EnumeratedThread& operator= (const EnumeratedThread& theCopy)
|
||||
{
|
||||
Assign (theCopy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assignment operator.
|
||||
void Assign (const EnumeratedThread& theCopy)
|
||||
{
|
||||
OSD_Thread::Assign (theCopy);
|
||||
myPool = theCopy.myPool;
|
||||
myJob = theCopy.myJob;
|
||||
myThreadIndex = theCopy.myThreadIndex;
|
||||
myToCatchFpe = theCopy.myToCatchFpe;
|
||||
myIsSelfThread = theCopy.myIsSelfThread;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Method is executed in the context of thread.
|
||||
@@ -290,6 +319,12 @@ protected:
|
||||
OSD_ThreadPool::JobInterface* theJob,
|
||||
int theThreadIndex);
|
||||
|
||||
private:
|
||||
//! This method should not be called (prohibited).
|
||||
OSD_ThreadPool (const OSD_ThreadPool& theCopy);
|
||||
//! This method should not be called (prohibited).
|
||||
OSD_ThreadPool& operator= (const OSD_ThreadPool& theCopy);
|
||||
|
||||
private:
|
||||
|
||||
NCollection_Array1<EnumeratedThread> myThreads; //!< array of defined threads (excluding self-thread)
|
||||
|
Reference in New Issue
Block a user