Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: JobSchedulerDemo Borsch
jobService.cpp
- Committer:
- sgnezdov
- Date:
- 2017-07-13
- Revision:
- 10:8cff30b5b90d
- Parent:
- 9:ee21cd055a97
- Child:
- 11:df18df016d7e
File content as of revision 10:8cff30b5b90d:
#include "jobService.h" #include "mbed-trace/mbed_trace.h" #define TRACE_GROUP "scjs" namespace JobScheduler { bool JobType::AscendingExcl(JobType *j2) { return this->_jobTypeID > j2->_jobTypeID; } bool JobType::IsEqual(JobType *j2) { tr_debug("IsEqual %d %d", this->_jobTypeID, j2->_jobTypeID); return this->_jobTypeID == j2->_jobTypeID; } bool jtAscending(JobType *j1, JobType *j2) { return j1->AscendingExcl(j2); } bool jtIsEqual(JobType *j1, JobType *j2) { return j1->IsEqual(j2); } Error JobService::Register(int jobTypeID, jobFunc *job, void *context) { JobType *jt = new JobType(jobTypeID, job, context); node<JobType> *tmp = _jobs.insertOrdered(jt, jtAscending); if (NULL == tmp) { tr_error("Failed to register job type id %d", jobTypeID); return Error(1); } return NoError; } JobType* JobService::GetJob(int jobTypeID) { JobType search = JobType(jobTypeID, NULL, NULL); node<JobType> *found = _jobs.pop(&search, jtIsEqual); if (found == NULL) { return NULL; } return found->data; } } // end of namespace