Skip to content

Commit

Permalink
Main: WorkQueue - move WorkerThreadCount to interface
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Dec 25, 2023
1 parent 87f24c9 commit 66a87b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
26 changes: 14 additions & 12 deletions OgreMain/include/OgreWorkQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ namespace Ogre
WorkQueue() {}
virtual ~WorkQueue() {}

/** Get the number of worker threads that this queue will start when
startup() is called.
*/
virtual size_t getWorkerThreadCount() const { return 1; }

/** Set the number of worker threads that this queue will start
when startup() is called (default 1).
Calling this will have no effect unless the queue is shut down and
restarted.
*/
virtual void setWorkerThreadCount(size_t c) {}

/** Start up the queue with the options that have been set.
@param forceRestart If the queue is already running, whether to shut it
down and restart.
Expand Down Expand Up @@ -218,17 +230,6 @@ namespace Ogre
virtual ~DefaultWorkQueueBase();
/// Get the name of the work queue
const String& getName() const;
/** Get the number of worker threads that this queue will start when
startup() is called.
*/
virtual size_t getWorkerThreadCount() const;

/** Set the number of worker threads that this queue will start
when startup() is called (default 1).
Calling this will have no effect unless the queue is shut down and
restarted.
*/
virtual void setWorkerThreadCount(size_t c);

/** Get whether worker threads will be allowed to access render system
resources.
Expand Down Expand Up @@ -283,7 +284,8 @@ namespace Ogre
unsigned long getResponseProcessingTimeLimit() const override { return mResposeTimeLimitMS; }
/// @copydoc WorkQueue::setResponseProcessingTimeLimit
void setResponseProcessingTimeLimit(unsigned long ms) override { mResposeTimeLimitMS = ms; }

size_t getWorkerThreadCount() const override { return mWorkerThreadCount; }
void setWorkerThreadCount(size_t c) override { mWorkerThreadCount = c; }
void addMainThreadTask(std::function<void()> task) override;
void addTask(std::function<void()> task) override;
protected:
Expand Down
10 changes: 0 additions & 10 deletions OgreMain/src/OgreWorkQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,6 @@ namespace Ogre {
return mName;
}
//---------------------------------------------------------------------
size_t DefaultWorkQueueBase::getWorkerThreadCount() const
{
return mWorkerThreadCount;
}
//---------------------------------------------------------------------
void DefaultWorkQueueBase::setWorkerThreadCount(size_t c)
{
mWorkerThreadCount = c;
}
//---------------------------------------------------------------------
bool DefaultWorkQueueBase::getWorkersCanAccessRenderSystem() const
{
return mWorkerRenderSystemAccess;
Expand Down

0 comments on commit 66a87b4

Please sign in to comment.