mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: misc cleanups
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a4448333c4
commit
9fbad985c0
6 changed files with 17 additions and 39 deletions
|
@ -39,7 +39,7 @@ namespace Kross {
|
|||
class InterpreterInfo::Private
|
||||
{
|
||||
public:
|
||||
/// The name the interpreter has. Could be something like "python" or "kjs".
|
||||
/// The name the interpreter has. Could be something like "python".
|
||||
QString interpretername;
|
||||
/// The function-pointer to the module factory function.
|
||||
void* funcPtr;
|
||||
|
|
|
@ -126,20 +126,8 @@ void DependencyPolicy::resolveDependencies( Job* job )
|
|||
QList<Job*> DependencyPolicy::getDependencies( Job* job ) const
|
||||
{
|
||||
Q_ASSERT (job != 0);
|
||||
QList<Job*> result;
|
||||
// basicly JobMultiMap
|
||||
QMapIterator<ThreadWeaver::Job*, ThreadWeaver::Job*> it(d->dependencies());
|
||||
QMutexLocker l( & d->mutex() );
|
||||
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
it.next();
|
||||
if ( it.key() == job )
|
||||
{
|
||||
result.append( it.value() );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return d->dependencies().values( job );
|
||||
}
|
||||
|
||||
bool DependencyPolicy::hasUnresolvedDependencies( Job* job ) const
|
||||
|
@ -167,16 +155,17 @@ void DependencyPolicy::free( Job* job )
|
|||
if ( job->success() )
|
||||
{
|
||||
resolveDependencies( job );
|
||||
kDebug() << "dependencies resolved for job" << (void*)job;
|
||||
kDebug() << "dependencies resolved for job" << job;
|
||||
} else {
|
||||
kDebug() << "not resolving dependencies (execution not successful) for" << (void*)job;
|
||||
kDebug() << "not resolving dependencies (execution not successful) for" << job;
|
||||
}
|
||||
Q_ASSERT ( ( ! hasUnresolvedDependencies( job ) && job->success() ) || ! job->success() );
|
||||
}
|
||||
|
||||
void DependencyPolicy::release( Job* job )
|
||||
{
|
||||
Q_ASSERT (job != 0); Q_UNUSED(job)
|
||||
Q_ASSERT (job != 0);
|
||||
Q_UNUSED (job);
|
||||
}
|
||||
|
||||
void DependencyPolicy::destructed( Job* job )
|
||||
|
@ -195,10 +184,10 @@ void DependencyPolicy::dumpJobDependencies()
|
|||
while ( it.hasNext() )
|
||||
{
|
||||
it.next();
|
||||
kDebug() << " : ("
|
||||
<< (void*)it.key() << it.key()->objectName() << it.key()->metaObject()->className()
|
||||
kDebug() << " :"
|
||||
<< it.key() << it.key()->objectName() << it.key()->metaObject()->className()
|
||||
<< "<--"
|
||||
<< (void*)it.value() << it.value()->objectName() << it.value()->metaObject()->className();
|
||||
<< it.value() << it.value()->objectName() << it.value()->metaObject()->className();
|
||||
}
|
||||
kDebug ( "-----------------" );
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ void JobCollection::stop( Job *job )
|
|||
Q_UNUSED( job );
|
||||
if ( d->weaver != 0 )
|
||||
{
|
||||
kDebug() << "dequeueing" << (void*)this;
|
||||
kDebug() << "dequeueing" << this;
|
||||
d->weaver->dequeue( this );
|
||||
}
|
||||
// FIXME Q_ASSERT ( d->weaver == 0 ); // verify that aboutToBeDequeued has been called
|
||||
|
@ -329,7 +329,7 @@ void JobCollection::dequeueElements()
|
|||
{
|
||||
if ( d->elements->at( index ) && ! d->elements->at( index )->isFinished() ) // ... a QPointer
|
||||
{
|
||||
kDebug() << "dequeueing" << (void*)d->elements->at( index );
|
||||
kDebug() << "dequeueing" << d->elements->at( index );
|
||||
d->weaver->dequeue ( d->elements->at( index ) );
|
||||
} else {
|
||||
kDebug() << "not dequeueing" << d->elements->at( index ) << ", already finished";
|
||||
|
|
|
@ -88,7 +88,7 @@ void ResourceRestrictionPolicy::free ( Job* job )
|
|||
|
||||
if (position != -1)
|
||||
{
|
||||
kDebug() << "job" << (void*)job << "done.";
|
||||
kDebug() << "job" << job << "done.";
|
||||
d->customers.removeAt (position);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,10 +67,6 @@ WeaverImpl::WeaverImpl( QObject* parent )
|
|||
m_states[ShuttingDown] = new ShuttingDownState( this );
|
||||
m_states[Destructed] = new DestructedState( this );
|
||||
|
||||
// FIXME (0.7) this is supposedly unnecessary
|
||||
connect ( this, SIGNAL (asyncThreadSuspended(ThreadWeaver::Thread*)),
|
||||
SIGNAL (threadSuspended(ThreadWeaver::Thread*)),
|
||||
Qt::QueuedConnection );
|
||||
setState( WorkingHard );
|
||||
}
|
||||
|
||||
|
@ -180,7 +176,7 @@ void WeaverImpl::enqueue(Job* job)
|
|||
{
|
||||
if (job) {
|
||||
adjustInventory ( 1 );
|
||||
kDebug() << "queueing job" << (void*)job << "of type " << job->metaObject()->className();
|
||||
kDebug() << "queueing job" << job << "of type " << job->metaObject()->className();
|
||||
QMutexLocker l (m_mutex); Q_UNUSED(l);
|
||||
job->aboutToBeQueued ( this );
|
||||
// find position for insertion:;
|
||||
|
@ -243,9 +239,9 @@ bool WeaverImpl::dequeue ( Job* job )
|
|||
|
||||
m_assignments.removeAt( i );
|
||||
result = true;
|
||||
kDebug() << "job" << (void*)job << "dequeued," << m_assignments.size() << "jobs left.";
|
||||
kDebug() << "job" << job << "dequeued," << m_assignments.size() << "jobs left.";
|
||||
} else {
|
||||
kDebug() << "job" << (void*)job << "not found in queue.";
|
||||
kDebug() << "job" << job << "not found in queue.";
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +353,7 @@ void WeaverImpl::waitForAvailableJob(Thread* th)
|
|||
void WeaverImpl::blockThreadUntilJobsAreBeingAssigned ( Thread *th )
|
||||
{ // th is the thread that calls this method:
|
||||
kDebug() << "thread"<< th->id() << "blocked.";
|
||||
emit asyncThreadSuspended ( th );
|
||||
emit threadSuspended ( th );
|
||||
QMutexLocker l( m_jobAvailableMutex );
|
||||
m_jobAvailable.wait( m_jobAvailableMutex );
|
||||
kDebug() << "thread"<< th->id() << "resumed.";
|
||||
|
@ -409,7 +405,7 @@ void WeaverImpl::dumpJobs()
|
|||
for ( int index = 0; index < m_assignments.size(); ++index ) {
|
||||
kDebug() << "-->"
|
||||
<< index << ":"
|
||||
<< (void*)m_assignments.at( index )
|
||||
<< m_assignments.at( index )
|
||||
<< m_assignments.at( index )->metaObject()->className()
|
||||
<< "(priority" << m_assignments.at(index)->priority()
|
||||
<< ", can be executed:" << m_assignments.at(index)->canBeExecuted() << ")";
|
||||
|
|
|
@ -124,13 +124,6 @@ namespace ThreadWeaver {
|
|||
/** The thread is busy executing job j. */
|
||||
void threadBusy ( ThreadWeaver::Thread*, ThreadWeaver::Job* j);
|
||||
|
||||
// FIXME (0.7) this seems to be unnecessary
|
||||
// some more private Q_SIGNALS: There are situations where other threads
|
||||
// call functions of (this). In this case, there may be confusion
|
||||
// about whether to handle the signals synchronously or not. The
|
||||
// following signals are asynchroneoulsy connected to their siblings.
|
||||
void asyncThreadSuspended( ThreadWeaver::Thread* );
|
||||
|
||||
protected:
|
||||
/** Adjust active thread count.
|
||||
This is a helper function for incActiveThreadCount and decActiveThreadCount. */
|
||||
|
|
Loading…
Add table
Reference in a new issue