[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdelibs/frameworks] tier1/threadweaver/src/Weaver: Use const-refs in enqueue and dequeue, instead o
From: Mirko Boehm (Endocode) <mirko () endocode ! com>
Date: 2013-10-31 22:58:27
Message-ID: E1Vc1C7-0002CX-Is () scm ! kde ! org
[Download RAW message or body]
Git commit c60f7cd1987b21db96629704ba7103db6d0c9292 by Mirko Boehm (Endocode).
Committed on 31/10/2013 at 20:45.
Pushed by mirko into branch 'frameworks'.
Use const-refs in enqueue and dequeue, instead of values.
M +2 -2 tier1/threadweaver/src/Weaver/DestructedState.cpp
M +2 -2 tier1/threadweaver/src/Weaver/DestructedState.h
M +2 -2 tier1/threadweaver/src/Weaver/ThreadWeaver.cpp
M +2 -2 tier1/threadweaver/src/Weaver/ThreadWeaver.h
M +2 -2 tier1/threadweaver/src/Weaver/WeaverImpl.cpp
M +2 -2 tier1/threadweaver/src/Weaver/WeaverImpl.h
M +2 -2 tier1/threadweaver/src/Weaver/WeaverImplState.cpp
M +2 -2 tier1/threadweaver/src/Weaver/WeaverImplState.h
M +2 -2 tier1/threadweaver/src/Weaver/WeaverInterface.h
http://commits.kde.org/kdelibs/c60f7cd1987b21db96629704ba7103db6d0c9292
diff --git a/tier1/threadweaver/src/Weaver/DestructedState.cpp \
b/tier1/threadweaver/src/Weaver/DestructedState.cpp index 4b81fa7..3435349 100644
--- a/tier1/threadweaver/src/Weaver/DestructedState.cpp
+++ b/tier1/threadweaver/src/Weaver/DestructedState.cpp
@@ -67,11 +67,11 @@ void DestructedState::registerObserver(WeaverObserver*)
{
}
-void DestructedState::enqueue(JobPointer)
+void DestructedState::enqueue(const JobPointer &)
{
}
-bool DestructedState::dequeue(JobPointer)
+bool DestructedState::dequeue(const JobPointer&)
{
return false;
}
diff --git a/tier1/threadweaver/src/Weaver/DestructedState.h \
b/tier1/threadweaver/src/Weaver/DestructedState.h index 906f873..88f2340 100644
--- a/tier1/threadweaver/src/Weaver/DestructedState.h
+++ b/tier1/threadweaver/src/Weaver/DestructedState.h
@@ -53,8 +53,8 @@ public:
int maximumNumberOfThreads() const Q_DECL_OVERRIDE;
int currentNumberOfThreads() const Q_DECL_OVERRIDE;
void registerObserver(WeaverObserver *obs) Q_DECL_OVERRIDE;
- void enqueue(JobPointer job) Q_DECL_OVERRIDE;
- bool dequeue(JobPointer job) Q_DECL_OVERRIDE;
+ void enqueue(const JobPointer& job) Q_DECL_OVERRIDE;
+ bool dequeue(const JobPointer& job) Q_DECL_OVERRIDE;
void dequeue() Q_DECL_OVERRIDE;
void finish() Q_DECL_OVERRIDE;
bool isEmpty() const Q_DECL_OVERRIDE;
diff --git a/tier1/threadweaver/src/Weaver/ThreadWeaver.cpp \
b/tier1/threadweaver/src/Weaver/ThreadWeaver.cpp index a9ec4fd..6704a59 100644
--- a/tier1/threadweaver/src/Weaver/ThreadWeaver.cpp
+++ b/tier1/threadweaver/src/Weaver/ThreadWeaver.cpp
@@ -136,7 +136,7 @@ Weaver* Weaver::instance()
return s_instance.loadAcquire();
}
-void Weaver::enqueue(JobPointer job)
+void Weaver::enqueue(const JobPointer &job)
{
d->implementation->enqueue(job);
}
@@ -146,7 +146,7 @@ void Weaver::enqueueRaw(JobInterface *job)
d->implementation->enqueueRaw(job);
}
-bool Weaver::dequeue(JobPointer job)
+bool Weaver::dequeue(const JobPointer& job)
{
return d->implementation->dequeue(job);
}
diff --git a/tier1/threadweaver/src/Weaver/ThreadWeaver.h \
b/tier1/threadweaver/src/Weaver/ThreadWeaver.h index f52044c..c6d5d7f 100644
--- a/tier1/threadweaver/src/Weaver/ThreadWeaver.h
+++ b/tier1/threadweaver/src/Weaver/ThreadWeaver.h
@@ -89,9 +89,9 @@ public:
created.
*/
static ThreadWeaver::Weaver* instance();
- void enqueue(JobPointer) Q_DECL_OVERRIDE;
+ void enqueue(const JobPointer&) Q_DECL_OVERRIDE;
void enqueueRaw(JobInterface* job) Q_DECL_OVERRIDE;
- bool dequeue(JobPointer) Q_DECL_OVERRIDE;
+ bool dequeue(const JobPointer&) Q_DECL_OVERRIDE;
bool dequeueRaw(JobInterface* job) Q_DECL_OVERRIDE;
void dequeue() Q_DECL_OVERRIDE;
void finish() Q_DECL_OVERRIDE;
diff --git a/tier1/threadweaver/src/Weaver/WeaverImpl.cpp \
b/tier1/threadweaver/src/Weaver/WeaverImpl.cpp index 724d757..b371923 100644
--- a/tier1/threadweaver/src/Weaver/WeaverImpl.cpp
+++ b/tier1/threadweaver/src/Weaver/WeaverImpl.cpp
@@ -221,7 +221,7 @@ void WeaverImpl::registerObserver_p(WeaverObserver *ext)
ext, SIGNAL (threadExited(ThreadWeaver::Thread*)));
}
-void WeaverImpl::enqueue(JobPointer job)
+void WeaverImpl::enqueue(const JobPointer& job)
{
QMutexLocker l(m_mutex); Q_UNUSED(l);
state()->enqueue(job);
@@ -251,7 +251,7 @@ void WeaverImpl::enqueue_p(JobPointer job)
}
}
-bool WeaverImpl::dequeue(JobPointer job)
+bool WeaverImpl::dequeue(const JobPointer &job)
{
QMutexLocker l(m_mutex); Q_UNUSED(l);
return state()->dequeue(job);
diff --git a/tier1/threadweaver/src/Weaver/WeaverImpl.h \
b/tier1/threadweaver/src/Weaver/WeaverImpl.h index a86b91b..b8700b8 100644
--- a/tier1/threadweaver/src/Weaver/WeaverImpl.h
+++ b/tier1/threadweaver/src/Weaver/WeaverImpl.h
@@ -77,9 +77,9 @@ public:
/** Set the object state. */
void setState( StateId );
void registerObserver(WeaverObserver*) Q_DECL_OVERRIDE;
- void enqueue(JobPointer job) Q_DECL_OVERRIDE;
+ void enqueue(const JobPointer& job) Q_DECL_OVERRIDE;
void enqueueRaw(JobInterface* job) Q_DECL_OVERRIDE;
- bool dequeue(JobPointer job) Q_DECL_OVERRIDE;
+ bool dequeue(const JobPointer& job) Q_DECL_OVERRIDE;
bool dequeueRaw(JobInterface* job) Q_DECL_OVERRIDE;
void dequeue() Q_DECL_OVERRIDE;
void finish() Q_DECL_OVERRIDE;
diff --git a/tier1/threadweaver/src/Weaver/WeaverImplState.cpp \
b/tier1/threadweaver/src/Weaver/WeaverImplState.cpp index 4bcbdb2..a387f62 100644
--- a/tier1/threadweaver/src/Weaver/WeaverImplState.cpp
+++ b/tier1/threadweaver/src/Weaver/WeaverImplState.cpp
@@ -89,12 +89,12 @@ void WeaverImplState::registerObserver(WeaverObserver *obs)
weaver()->registerObserver_p(obs);
}
-void WeaverImplState::enqueue(JobPointer job)
+void WeaverImplState::enqueue(const JobPointer &job)
{
weaver()->enqueue_p(job);
}
-bool WeaverImplState::dequeue(JobPointer job)
+bool WeaverImplState::dequeue(const JobPointer& job)
{
return weaver()->dequeue_p(job);
}
diff --git a/tier1/threadweaver/src/Weaver/WeaverImplState.h \
b/tier1/threadweaver/src/Weaver/WeaverImplState.h index fbd8009..f021fdc 100644
--- a/tier1/threadweaver/src/Weaver/WeaverImplState.h
+++ b/tier1/threadweaver/src/Weaver/WeaverImplState.h
@@ -59,9 +59,9 @@ public:
/** Register an observer. */
void registerObserver(WeaverObserver* obs) Q_DECL_OVERRIDE;
/** Enqueue a job. */
- void enqueue(JobPointer job) Q_DECL_OVERRIDE;
+ void enqueue(const JobPointer& job) Q_DECL_OVERRIDE;
/** Dequeue a job. */
- bool dequeue(JobPointer job) Q_DECL_OVERRIDE;
+ bool dequeue(const JobPointer& job) Q_DECL_OVERRIDE;
/** Dequeue all jobs. */
void dequeue() Q_DECL_OVERRIDE;
/** Finish all queued jobs. */
diff --git a/tier1/threadweaver/src/Weaver/WeaverInterface.h \
b/tier1/threadweaver/src/Weaver/WeaverInterface.h index 7a66092..8df9fc2 100644
--- a/tier1/threadweaver/src/Weaver/WeaverInterface.h
+++ b/tier1/threadweaver/src/Weaver/WeaverInterface.h
@@ -103,7 +103,7 @@ public:
JobPointer is a shared pointer. This means the object pointed to will be deleted \
if this object
is the last remaining reference to it. Keep a JobPointer to the job to avoid \
automatic deletion.
*/
- virtual void enqueue(JobPointer job) = 0;
+ virtual void enqueue(const JobPointer& job) = 0;
/** Add a job to be executed.
*
@@ -126,7 +126,7 @@ public:
* @return true if the job was waiting and has been dequeued
* @return false if the job was not found waiting in the queue
*/
- virtual bool dequeue(JobPointer job) = 0;
+ virtual bool dequeue(const JobPointer& job) = 0;
/** Remove a raw job from the queue.
* @see dequeue(JobPointer)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic