SPrtyExecMap_tag;
43 typedefintr::set_base_hook<intr::tag<SPrtyExecMap_tag>,
75intr::base_hook<TPrtyExecMapHook>,
76intr::constant_time_size<false>,
121 if(it != prty_map.end())
126prty_map.insert(*exec_queue);
151exec_queue->
tasks.push_front(*task);
153exec_queue->
tasks.push_back(*task);
156exec_queue->
tasks.push_back(*task);
171TPrtyExecMap::iterator it_first = tasks_map.begin();
172 while(it_first != tasks_map.end() && it_first->tasks.empty())
174 if(it_first == tasks_map.end()) {
185TPrtyExecMap::iterator it_next = it_first;
187 while(it_next != tasks_map.end()) {
189 if(!q_next->
tasks.empty()
198 if(it_next != tasks_map.end()) {
204q_exec->
tasks.pop_front();
216 return Uint4(
thr->sched->cnt_signal.GetValue()) >=
thr->sched->max_tasks * max_coef
231prefer_thr = cur_thr? cur_thr:
s_Threads[1];
234try_all_checks_again:
237 Uint1pref_chain_tries = 2;
243 if(queue_thr != prefer_thr) {
252 if(pref_chain_tries != 0) {
259 gotocheck_thr_overload;
279 gotoselect_queue_thr;
289 returncur_thr? cur_thr: prefer_thr;
294 returncur_thr? cur_thr: prefer_thr;
306 gototry_all_checks_again;
318task_lst.splice_after(task_lst.end(), exec_q->
tasks);
328 while(!task_lst.empty()) {
329 CSrvTask* task = &task_lst.front();
330task_lst.pop_front();
379 if(max_tasks > 2 && max_tasks <
Uint4(-1))
407 if(jiffy_time.
Sec() != 0) {
430 else if(
thr->thread_num != 1)
489 SRV_FATAL(
"Invalid task flags: "<< old_flags);
502 SRV_FATAL(
"Invalid task flags: "<< old_flags);
549 thr->cur_task = task;
581 stringis(
"\": "), eol(
",\n\"");
static void s_ResetMaxTasks(SSchedInfo *sched)
static bool s_IsThreadOverloaded(SSrvThread *thr, Uint4 max_coef)
static SSrvThread * s_FindQueueThread(TSrvThreadNum prefer_num, SSrvThread *cur_thr)
static int s_IdleStopTimeout
static void s_FindRebalanceTasks(SSrvThread *cur_thr)
void MarkTaskTerminated(CSrvTask *task, bool immediate)
static void s_MarkTaskRunning(CSrvTask *task)
intr::set_base_hook< intr::tag< SPrtyExecMap_tag >, intr::optimize_size< true > > TPrtyExecMapHook
void SchedStartJiffy(SSrvThread *thr)
static void s_AddTaskToQueue(SSrvThread *thr, CSrvTask *task, bool boost=false)
void ConfigureScheduler(const CNcbiRegistry *reg, CTempString section)
static SPrtyExecQueue * s_GetExecQueue(TPrtyExecMap &prty_map, Uint4 priority)
bool ReConfig_Scheduler(const CTempString §ion, const CNcbiRegistry ®, string &)
static void s_MarkTaskExecuted(CSrvTask *task, SSrvThread *thr)
static CSrvTask * s_UnqueueTask(SSchedInfo *sched)
static void s_DoTermination(CSrvTask *task)
Uint4 GetDefaultTaskPriority(void)
intr::set< SPrtyExecQueue, intr::base_hook< TPrtyExecMapHook >, intr::constant_time_size< false >, intr::compare< SPrtyExecCompare > > TPrtyExecMap
static Uint4 s_TaskPriorityDefault
static Uint4 s_MaxTaskLatency
void ReleaseThreadSched(SSrvThread *thr)
static void s_BalanceTasks(SSchedInfo *sched, SSrvThread *cur_thr)
void AssignThreadSched(SSrvThread *thr)
void WriteSetup_Scheduler(CSrvSocketTask &task)
bool SchedIsAllIdle(void)
void SchedCheckOverloads(void)
static Uint4 s_MaxTasksCoef
void SchedExecuteTask(SSrvThread *thr)
static void s_ResetExecTime(SSchedInfo *sched)
Wrapper around Linux's futex.
EWaitResult WaitValueChange(int old_value)
Wait for futex's value to change (with and without timeout).
int GetValue(void)
Read value of the futex.
void SetValueNonAtomic(int new_value)
Set futex's value non-atomically, i.e.
int WakeUpWaiters(int cnt_to_wake)
Wake up some threads waiting on this futex.
Mutex created to have minimum possible size (its size is 4 bytes) and to sleep using kernel capabilit...
void Unlock(void)
Unlock the mutex.
void Lock(void)
Lock the mutex.
void CallRCU(void)
Method to be called to schedule call of ExecuteRCU() at appropriate time.
Task controlling a socket.
CSrvSocketTask & WriteText(CTempString message)
Write text into socket.
CSrvSocketTask & WriteNumber(NumType num)
Write number into socket as string, i.e.
virtual ~CSrvTaskTerminator(void)
virtual void ExecuteRCU(void)
Method implementing RCU job that was scheduled earlier by CallRCU().
Main working entity in TaskServer.
TSrvTaskFlags m_TaskFlags
Bit-OR of flags for this task.
TSrvThreadNum m_LastThread
Thread number where this task was executed last time.
CSrvTaskTerminator m_Terminator
Object that will delete this task after call to Terminate().
void SetRunnable(bool boost=false)
Set this task "runnable", i.e.
virtual void Terminate(void)
Stops task's execution and deletes it.
virtual void InternalRunSlice(TSrvThreadNum thr_num)
This is the real time slice execution method called from TaskServer.
Class incorporating convenient methods to work with struct timespec.
time_t & Sec(void)
Read/set number of seconds since epoch stored in the object.
static CSrvTime Current(void)
Exact current time with precision up to nanoseconds.
Uint8 AsUSec(void) const
Converts object's value to microseconds since epoch.
static bool IsInShutdown(void)
Checks if TaskServer received request to shutdown.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
uint8_t Uint1
1-byte (8-bit) unsigned integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
virtual int GetInt(const string §ion, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get integer value of specified parameter name.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Process information in the NCBI Registry, including working with configuration files.
TSrvThreadNum s_MaxRunningThreads
#define ACCESS_ONCE(x)
Purpose of this macro is to force compiler to access variable exactly at the place it's written (no m...
bool AtomicCAS(T volatile &var, T old_value, T new_value)
intr::slist< CSrvTask, TSrvTaskListOpt, intr::cache_last< true >, intr::constant_time_size< true >, intr::size_type< Uint4 > > TSrvTaskList
bool operator()(const SPrtyExecQueue &left, const SPrtyExecQueue &right) const
TSrvThreadNum prefer_thr_num
CFutex cnt_signal
This futex has total number of tasks in the tasks_map as a value.
Uint2 TSrvThreadNum
Type for thread number in TaskServer.
ESrvTaskFlags
Type for flags in CSrvTask.
CRef< CTestThread > thr[k_NumThreadsMax]
void RequestThreadStart(SSrvThread *thr)
void RequestThreadStop(SSrvThread *thr)
SSrvThread * GetCurThread(void)
void RequestThreadRevive(SSrvThread *thr)
bool IsThreadRunning(SSrvThread *thr)
void RemoveTaskFromTimer(CSrvTask *task, TSrvTaskFlags new_flags)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4