Example #1
0
void panic(char *msg, int line, char *file)
{
	cli();
	printk("[KERNEL PANIC]");
	printk("%s. Error at line %d in file %s.", msg, line, file);
	flush_video();
	keep_running();
}
void scheduler::startup() {
    // lock mutex for thread safety
    std::lock_guard<std::mutex> scheduler_lock(mutex);

    if (!running) {
        STATICLIB_PION_LOG_INFO(log, "Starting thread scheduler");
        running = true;

        // schedule a work item to make sure that the service doesn't complete
        asio_service.reset();
        keep_running(asio_service, timer);

        // start multiple threads to handle async tasks
        for (uint32_t n = 0; n < num_threads; ++n) {
            std::unique_ptr<std::thread> new_thread(new std::thread([this]() {
                this->process_service_work(this->asio_service);
                this->thread_stop_hook();
            }));
            thread_pool.emplace_back(std::move(new_thread));
        }
    }
}