• Home
  • Raw
  • Download

Lines Matching refs:scheduler

73     struct scheduler             * scheduler;
133 struct skc_scheduler * scheduler = (struct skc_scheduler*) in skc_scheduler_create() local
134 skc_runtime_host_perm_alloc(runtime,SKC_MEM_FLAGS_READ_WRITE,sizeof(*scheduler)); in skc_scheduler_create()
137 new (scheduler) skc_scheduler(); in skc_scheduler_create()
140 scheduler->extent = (struct skc_scheduler_command*) in skc_scheduler_create()
141 … skc_runtime_host_perm_alloc(runtime,SKC_MEM_FLAGS_READ_WRITE,(sizeof(*scheduler->extent) * size)); in skc_scheduler_create()
143 scheduler->available.indices = (skc_ushort*) in skc_scheduler_create()
144 …skc_runtime_host_perm_alloc(runtime,SKC_MEM_FLAGS_READ_WRITE,sizeof(*scheduler->available.indices)… in skc_scheduler_create()
146 scheduler->available.rem = size; in skc_scheduler_create()
148 scheduler->waiting.indices = (skc_ushort*) in skc_scheduler_create()
149 …skc_runtime_host_perm_alloc(runtime,SKC_MEM_FLAGS_READ_WRITE,sizeof(*scheduler->available.indices)… in skc_scheduler_create()
151 scheduler->waiting.size = size + 1; // the ring has an extra slot in skc_scheduler_create()
152 scheduler->waiting.head = 0; in skc_scheduler_create()
153 scheduler->waiting.tail = 0; in skc_scheduler_create()
156 scheduler->available.indices[ii] = ii; in skc_scheduler_create()
158 return scheduler; in skc_scheduler_create()
163 struct skc_scheduler * const scheduler) in skc_scheduler_dispose() argument
166 skc_runtime_host_perm_free(runtime,scheduler->waiting.indices); in skc_scheduler_dispose()
167 skc_runtime_host_perm_free(runtime,scheduler->available.indices); in skc_scheduler_dispose()
168 skc_runtime_host_perm_free(runtime,scheduler->extent); in skc_scheduler_dispose()
171 scheduler->~skc_scheduler(); in skc_scheduler_dispose()
174 skc_runtime_host_perm_free(runtime,scheduler); in skc_scheduler_dispose()
183 skc_scheduler_acquire(struct skc_scheduler * const scheduler, in skc_scheduler_acquire() argument
192 std::lock_guard<std::mutex> lock(scheduler->available.mutex); in skc_scheduler_acquire()
195 if (scheduler->available.rem > 0) in skc_scheduler_acquire()
196 command = scheduler->available.indices[--scheduler->available.rem]; in skc_scheduler_acquire()
204 struct skc_scheduler_command * const sc = scheduler->extent + command; in skc_scheduler_acquire()
222 skc_scheduler_release(struct skc_scheduler * const scheduler, in skc_scheduler_release() argument
226 std::lock_guard<std::mutex> lock(scheduler->available.mutex); in skc_scheduler_release()
229 scheduler->available.indices[scheduler->available.rem++] = command; in skc_scheduler_release()
240 skc_scheduler_append(struct skc_scheduler * const scheduler, in skc_scheduler_append() argument
243 scheduler->extent[command].state = SKC_SCHEDULER_COMMAND_STATE_WAITING; in skc_scheduler_append()
247 std::unique_lock<std::mutex> lock(scheduler->waiting.mutex); in skc_scheduler_append()
252 scheduler->waiting.indices[scheduler->waiting.tail] = command; in skc_scheduler_append()
255 if (++scheduler->waiting.tail == scheduler->waiting.size) in skc_scheduler_append()
256 scheduler->waiting.tail = 0; in skc_scheduler_append()
262 scheduler->waiting.condvar.notify_one(); in skc_scheduler_append()
270 skc_scheduler_schedule(struct skc_scheduler * const scheduler, in skc_scheduler_schedule() argument
277 skc_scheduler_command_t const command = skc_scheduler_acquire(scheduler,pfn,data,name); in skc_scheduler_schedule()
281 skc_scheduler_append(scheduler,command); in skc_scheduler_schedule()
287 skc_scheduler_wait(scheduler); in skc_scheduler_schedule()
298 skc_scheduler_pop(struct skc_scheduler * const scheduler, in skc_scheduler_pop() argument
304 std::unique_lock<std::mutex> lock(scheduler->waiting.mutex); in skc_scheduler_pop()
306 if (scheduler->waiting.head != scheduler->waiting.tail) in skc_scheduler_pop()
309 *command = scheduler->waiting.indices[scheduler->waiting.head]; in skc_scheduler_pop()
312 if (++scheduler->waiting.head == scheduler->waiting.size) in skc_scheduler_pop()
313 scheduler->waiting.head = 0; in skc_scheduler_pop()
321 skc_scheduler_pop_wait(struct skc_scheduler * const scheduler, in skc_scheduler_pop_wait() argument
325 std::unique_lock<std::mutex> lock(scheduler->waiting.mutex); in skc_scheduler_pop_wait()
328 scheduler->waiting.condvar.wait(lock,[scheduler] { in skc_scheduler_pop_wait()
329 return scheduler->waiting.head != scheduler->waiting.tail; in skc_scheduler_pop_wait()
333 *command = scheduler->waiting.indices[scheduler->waiting.head]; in skc_scheduler_pop_wait()
336 if (++scheduler->waiting.head == scheduler->waiting.size) in skc_scheduler_pop_wait()
337 scheduler->waiting.head = 0; in skc_scheduler_pop_wait()
359 skc_scheduler_execute(struct skc_scheduler * const scheduler, in skc_scheduler_execute() argument
364 skc_scheduler_command_execute(scheduler->extent + command); in skc_scheduler_execute()
367 skc_scheduler_release(scheduler,command); in skc_scheduler_execute()
375 skc_scheduler_yield(struct skc_scheduler * const scheduler) // wait for 0 or more completed grids in skc_scheduler_yield() argument
383 skc_scheduler_pop(scheduler,&command); in skc_scheduler_yield()
391 skc_scheduler_execute(scheduler,command); in skc_scheduler_yield()
404 skc_scheduler_wait(struct skc_scheduler * const scheduler) in skc_scheduler_wait() argument
411 skc_scheduler_pop_wait(scheduler,&command); in skc_scheduler_wait()
414 skc_scheduler_execute(scheduler,command); in skc_scheduler_wait()
417 skc_scheduler_yield(scheduler); in skc_scheduler_wait()
427 skc_scheduler_wait_one(struct skc_scheduler * const scheduler) in skc_scheduler_wait_one() argument
434 skc_scheduler_pop_wait(scheduler,&command); in skc_scheduler_wait_one()
437 skc_scheduler_execute(scheduler,command); in skc_scheduler_wait_one()
458 skc_scheduler_wait_for(struct skc_scheduler * const scheduler,
461 struct skc_scheduler_command * const sc = scheduler->extent + command;
480 skc_scheduler_pop_wait(scheduler,&next);
483 skc_scheduler_execute(scheduler,next);