|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
25 #ifndef __AAMP_SCHEDULER_H__
26 #define __AAMP_SCHEDULER_H__
32 #include <condition_variable>
38 #ifndef __UNIT_TESTING__
43 #define AAMPLOG_WARN(FORMAT, ...) { printf(FORMAT,##__VA_ARGS__);printf("\n");}
44 #define AAMPLOG_INFO(FORMAT, ...) { printf(FORMAT,##__VA_ARGS__);printf("\n");}
45 #define AAMPLOG_ERR(FORMAT, ...) { printf(FORMAT,##__VA_ARGS__);printf("\n");}
46 #define AAMPLOG_TRACE(FORMAT, ...) { printf(FORMAT,##__VA_ARGS__);printf("\n");}
48 #define AAMP_SCHEDULER_ID_MAX_VALUE INT_MAX // 10000
49 #define AAMP_SCHEDULER_ID_DEFAULT 1 //ID ranges from DEFAULT to MAX
52 typedef std::function<void (
void *)> AsyncTask;
62 std::string mTaskName;
64 AsyncTaskObj(AsyncTask task,
void *data, std::string tskName=
"",
int id = AAMP_TASK_ID_INVALID) :
65 mTask(task), mData(data), mId(
id),mTaskName(tskName)
69 AsyncTaskObj(
const AsyncTaskObj &other) : mTask(other.mTask), mData(other.mData), mId(other.mId),mTaskName(other.mTaskName)
78 mTaskName = other.mTaskName;
171 #ifndef __UNIT_TESTING__
int ScheduleTask(AsyncTaskObj obj)
To schedule a task to be executed later.
std::thread mSchedulerThread
void EnableScheduleTask()
To enable scheduler to queue new tasks.
void SetState(PrivAAMPState sstate)
To player state to Scheduler.
AampScheduler()
AampScheduler Constructor.
std::unique_lock< std::mutex > mExLock
void SetLogger(AampLogManager *logObj)
Set the logger instance for the Scheduler.
void StartScheduler()
To start scheduler thread.
Scheduler class for asynchronous operations.
virtual ~AampScheduler()
AampScheduler Destructor.
void ResumeScheduler()
To release execution lock.
bool RemoveTask(int id)
To remove a scheduled tasks with ID.
void StopScheduler()
To stop scheduler and associated resources.
std::condition_variable mQCond
PrivAAMPState
Mapping all required status codes based on JS player requirement. These requirements may be forced by...
void SuspendScheduler()
To acquire execution lock for synchronisation purposes.
Events supported by the AAMP player.
std::deque< AsyncTaskObj > mTaskQueue
void RemoveAllTasks()
To remove all scheduled tasks and prevent further tasks from scheduling.
void ExecuteAsyncTask()
Executes scheduled tasks - invoked by thread.