Exemplo n.º 1
0
bool
O2Client::
Start(void)
{
	if (Active) {
		if (Logger) {
			Logger->AddLog(O2LT_WARNING, ClientName.c_str(), 0, 0,
				L"起動済のため起動要求を無視");
		}
		return false;
	}

	Active = true;
	QueueExistSignal.Off();
	SessionExistSignal.Off();

	NetIOThreadHandle =
		(HANDLE)_beginthreadex(NULL, 0, StaticNetIOThread, this, 0, NULL);
	LaunchThreadHandle =
		(HANDLE)_beginthreadex(NULL, 0, StaticLaunchThread, this, 0, NULL);

	OnClientStart();

	if (Logger)
		Logger->AddLog(O2LT_INFO, ClientName.c_str(), 0, 0, L"起動");
	return true;
}
Exemplo n.º 2
0
bool
O2Client::
Start(void)
{
	if (Active) {
		if (Logger) {
			Logger->AddLog(O2LT_WARNING, ClientName.c_str(), 0, 0,
				       L"起動済のため起動要求を無視");
		}
		return false;
	}

	Active = true;
	QueueExistSignal.Off();
	SessionExistSignal.Off();

#ifdef _WIN32 /** win32 thread */
	NetIOThreadHandle =
		(HANDLE)_beginthreadex(NULL, 0, StaticNetIOThread, this, 0, NULL);
	LaunchThreadHandle =
		(HANDLE)_beginthreadex(NULL, 0, StaticLaunchThread, this, 0, NULL);

#else   /** POSIX thread */
	handles[0] = neosmart::CreateEvent();
	handles[1] = neosmart::CreateEvent();

	pthread_attr_t attr1;
	if (pthread_attr_init(&attr1)) return false;
	pthread_create(&NetIOThreadHandle, &attr1, StaticNetIOThread, this);

	pthread_attr_t attr2;
	if (pthread_attr_init(&attr2)) return false;
	pthread_create(&LaunchThreadHandle, &attr2, StaticLaunchThread, this);
#endif

	OnClientStart();

	if (Logger)
		Logger->AddLog(O2LT_INFO, ClientName.c_str(), 0, 0, L"起動");
	return true;
}