示例#1
0
void *obs_hotkey_thread(void *arg)
{
	UNUSED_PARAMETER(arg);
	while (os_event_timedwait(obs->hotkeys.stop_event, 25) == ETIMEDOUT) {
		if (!lock())
			continue;

		query_hotkeys();
		unlock();
	}
	return NULL;
}
示例#2
0
static void *reconnect_thread(void *param)
{
	struct coreaudio_data *ca = param;

	ca->reconnecting = true;

	while (os_event_timedwait(ca->exit_event, ca->retry_time) == ETIMEDOUT) {
		if (coreaudio_init(ca))
			break;
	}

	blog(LOG_DEBUG, "coreaudio: exit the reconnect thread");
	ca->reconnecting = false;
	return NULL;
}
示例#3
0
static void *reconnect_thread(void *param)
{
	struct obs_output *output = param;
	unsigned long ms = output->reconnect_retry_sec * 1000;

	output->reconnect_thread_active = true;

	if (os_event_timedwait(output->reconnect_stop_event, ms) == ETIMEDOUT)
		obs_output_start(output);

	if (os_event_try(output->reconnect_stop_event) == EAGAIN)
		pthread_detach(output->reconnect_thread);

	output->reconnect_thread_active = false;
	return NULL;
}
示例#4
0
void *obs_hotkey_thread(void *arg)
{
	UNUSED_PARAMETER(arg);

	const char *hotkey_thread_name =
		profile_store_name(obs_get_profiler_name_store(),
				"obs_hotkey_thread(%g"NBSP"ms)", 25.);
	profile_register_root(hotkey_thread_name, (uint64_t)25000000);

	while (os_event_timedwait(obs->hotkeys.stop_event, 25) == ETIMEDOUT) {
		if (!lock())
			continue;

		profile_start(hotkey_thread_name);
		query_hotkeys();
		profile_end(hotkey_thread_name);

		unlock();

		profile_reenable_thread();
	}
	return NULL;
}
void BrowserManager::Impl::BrowserManagerEntry()
{
	std::string bootstrapPath = getBootstrap();
	bool thread_exit = false;
	PushEvent([] {
		CefMainArgs mainArgs;
		CefSettings settings;
		settings.log_severity = LOGSEVERITY_VERBOSE;
		settings.windowless_rendering_enabled = true;
		settings.no_sandbox = true;
		CefString(&settings.cache_path).FromASCII(obs_module_config_path(""));
		CefString(&settings.browser_subprocess_path) = getBootstrap();
		CefRefPtr<BrowserApp> app(new BrowserApp());
		CefExecuteProcess(mainArgs, app, nullptr);
		CefInitialize(mainArgs, settings, app, nullptr);
		CefRegisterSchemeHandlerFactory("http", "absolute", new BrowserSchemeHandlerFactory());
		CefRunMessageLoop();
		CefShutdown();
	});

	while (true) {
		
		if (os_event_timedwait(dispatchEvent, 10) != ETIMEDOUT) {
			pthread_mutex_lock(&dispatchLock);
			while (!queue.empty()) {
				auto event = queue[0];
				event();
				queue.erase(queue.begin());
			}
			thread_exit = !threadAlive;
			pthread_mutex_unlock(&dispatchLock);
			if (thread_exit) {
				return;
			}
		}
	}
}