Mostly style-related changes to package kit:

* drop 'Haiku' namespace
* rename 'Package' namespace to 'BPackageKit'
* renamed all public classes to begin with a 'B'
* renamed BPackageKit::Roster to BPackageKit::BPackageRoster to not
  clash with the BRoster from the application kit.
* fix some instances of public headers including private ones

Some functional changes, too:
* JobQueue now removes and deletes dependants of failed jobs 
  automatically
* JobQueue supports waiting for jobs to become runnable
* added a couple of InitCheck() methods where they make sense
  and invoke those in users of these classes



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40287 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2011-01-25 17:07:27 +00:00
parent 5ba9397df3
commit 7d7ed9bf4b
43 changed files with 746 additions and 640 deletions
+31 -20
View File
@@ -2,8 +2,8 @@
* Copyright 2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _HAIKU__PACKAGE__JOB_QUEUE_H_
#define _HAIKU__PACKAGE__JOB_QUEUE_H_
#ifndef _PACKAGE__PRIVATE__JOB_QUEUE_H_
#define _PACKAGE__PRIVATE__JOB_QUEUE_H_
#include <Locker.h>
@@ -12,44 +12,55 @@
#include <package/Job.h>
namespace Haiku {
namespace BPackageKit {
namespace Package {
namespace Private {
namespace BPrivate {
class JobQueue : public JobStateListener {
class JobQueue : private BJobStateListener {
public:
JobQueue();
~JobQueue();
virtual ~JobQueue();
status_t AddJob(Job* job);
status_t RemoveJob(Job* job);
status_t InitCheck() const;
Job* Pop();
status_t AddJob(BJob* job);
// takes ownership
status_t RemoveJob(BJob* job);
// gives up ownership
// JobStateListener
virtual void JobSucceeded(Job* job);
virtual void JobFailed(Job* job);
BJob* Pop();
// caller owns job
void Close();
private:
// BJobStateListener
virtual void JobSucceeded(BJob* job);
virtual void JobFailed(BJob* job);
private:
struct JobPriorityLess;
class JobPriorityQueue;
private:
void _UpdateDependantJobsOf(Job* job);
status_t _Init();
void _RequeueDependantJobsOf(BJob* job);
void _RemoveDependantJobsOf(BJob* job);
BLocker fLock;
uint32 fNextTicketNumber;
JobPriorityQueue* fQueuedJobs;
sem_id fHaveRunnableJobSem;
status_t fInitStatus;
};
} // namespace Private
} // namespace BPrivate
} // namespace Package
} // namespace Haiku
} // namespace BPackageKit
#endif // _HAIKU__PACKAGE__JOB_QUEUE_H_
#endif // _PACKAGE__PRIVATE__JOB_QUEUE_H_