コード例 #1
0
ファイル: OrkAudio.cpp プロジェクト: HiPiH/Oreka
int main(int argc, char* argv[])
{
	// the "service name" reported on the tape messages uses CONFIG.m_serviceName
	// which also defaults to orkaudio-[hostname] but can be different depending on the 
	// value set in config.xml
	char hostname[40];
	ACE_OS::hostname(hostname, 40);
	CStdString serviceName = CStdString("orkaudio-") + hostname;
	Daemon::Initialize(serviceName, MainThread, StopHandler);

	CStdString argument = argv[1];
	if (argc>1)
	{
		if(argument.CompareNoCase("version") == 0)
		{
			printf("Version my 2\n\n");
		}
		if (argument.CompareNoCase("debug") == 0)
		{
			MainThread();
		}
		else if (argument.CompareNoCase("transcode") == 0)
		{
			if(argc == 3)
			{
				Daemon::Singleton()->SetShortLived();
				CStdString file = argv[2];
				Transcode(file);
			}
			else
			{
				printf("Please specify file to transcode\n\n");
			}
		}
		else if (argument.CompareNoCase("install") == 0)
		{
			Daemon::Singleton()->Install();
		}
		else if  (argument.CompareNoCase("uninstall") == 0)
		{
			Daemon::Singleton()->Uninstall();
		}
		else
		{
#ifdef WIN32
	printf("Argument incorrect. Possibilies are:\ninstall: install NT service\nuninstall: uninstall NT service\ntranscode <file>: convert .mcf file to storage format specified in config.xml\n\n");
#else
	printf("Argument incorrect. Possibilies are:\ndebug: run attached to tty\ntranscode <file>: convert .mcf file to storage format specified in config.xml\n\n");
#endif
		}
	}
	else
	{
		// No arguments, launch the daemon
		printf("Starting orkaudio daemon ... (type 'orkaudio debug' if you prefer running attached to tty)\n");
		Daemon::Singleton()->Start();		
	}
	return 0;
}
コード例 #2
0
ファイル: CSuite.cpp プロジェクト: cdaffara/symbiandump-os1
enum TVerdict CCapabilityTestStep::doTestStepL()
	{
	//DEF! INFO_PRINTF2(_L("%S - Starting ..."), &iTestStepName);

	//The MainThread()creates a separate thread that executes SendReceive
	TVerdict vResult = MainThread();

	SetTestStepResult(vResult);
	return TestStepResult();
	}
コード例 #3
0
VOID main(int argc, char **argv)
#endif
{
MainThreadParams cmdline;

    cmdline.argc   = argc;
    cmdline.argv   = argv;
    cmdline.myname = argv[0];

    MainThread(&cmdline);
}
コード例 #4
0
void DataTransferAppImpl::login(const std::string username, const std::string password, const std::string xmpp_server_name, const int port) {
	buzz::Jid jid(username, xmpp_server_name, JID_RESOURCE);
	buzz::XmppClientSettings xclientSettings;

	if(!jid.IsValid() || jid.node() == ""){
		std::string errDesc = "Invalid JID. Node id or server name is missing.";
		LOG(LERROR) << errDesc;
		SignalLoginFailed(jid.node(), errDesc, MalformedID);
		return;
	}

	xclientSettings.set_user(jid.node());
	xclientSettings.set_resource("data");
	xclientSettings.set_host(jid.domain());
	xclientSettings.set_allow_plain(true);
	xclientSettings.set_use_tls(false);
	xclientSettings.set_server(talk_base::SocketAddress(xmpp_server_name, port));

	talk_base::InsecureCryptStringImpl pass;
	pass.password() = password;
	xclientSettings.set_pass(talk_base::CryptString(pass));

	tunnel_dt_client.SetXMPPServer(xmpp_server_name);
	pump.client() -> SignalStateChange.connect(&tunnel_dt_client, &TunnelDataTransferClient::OnStateChange);

	talk_base::ThreadManager::SetCurrent(main_thread);

	LOG(INFO) << "started doLogin"<< std::endl;

	xmppSocket = new XmppSocket(true);
	pump.DoLogin(xclientSettings, xmppSocket, NULL);

	if(!MainThread()->started()){
		MainThread()->Run();
	}
}
コード例 #5
0
ファイル: Main.c プロジェクト: ee230/trunks
int main(void) {
	/* Turn off the watchdog timer                                       */
	WDTCTL = WDTPW | WDTHOLD;

	/* Configure the hardware for its intended use.                      */
	HAL_ConfigureHardware();

	/* Enable interrupts and call the main application thread.           */
	__enable_interrupt();
	MainThread();

	/* MainThread should run continously, if it exits an error occured.  */
	while (1) {
		HAL_LedToggle(0);
		BTPS_Delay(100);
	}
}
コード例 #6
0
void DataTransferAppImpl::OnMessage(talk_base::Message *msg){
	switch (msg->message_id) {
	case APP_LOGIN:{
		talk_base::ScopedMessageData<LoginInfo> *loginInfo = static_cast<talk_base::ScopedMessageData<LoginInfo>*>(msg->pdata);
		login(loginInfo->data()->Username(), loginInfo->data()->Password(), loginInfo->data()->Servername(), loginInfo->data()->ServerPort());
		break;
				   }

	case APP_LOGOUT:{
		logout();
		break;
					}
	case APP_SEND:{
		ASSERT(MainThread()->IsCurrent());
		talk_base::TypedMessageData<std::string> *tunnelIDPtr = static_cast<talk_base::TypedMessageData<std::string>*>(msg->pdata);
		send(tunnelIDPtr->data());
		break;
				  }
	}
}
コード例 #7
0
ファイル: openmp1.c プロジェクト: DMDZYP/pthread-win32
int
test_openmp1(int argc, char *argv[])
#endif
{
  short OK;

  if (argc>1) Verbose = 1;

#ifdef _OPENMP
  omp_set_nested(-1);
  printf("%s%s%s\n", "Nested parallel blocks are ", omp_get_nested()?" ":"NOT ", "supported.");
#endif

  MainThread();

#ifdef SPAWN_THREADS
  {
    pthread_t a_thr;
    pthread_t b_thr;
    int status;

	memset(&a_thr, 0, sizeof(a_thr)); /* [i_a] fix valid MSVC complaint about unitialized a_thr / b_thr */
	memset(&b_thr, 0, sizeof(b_thr)); /* [i_a] fix valid MSVC complaint about unitialized a_thr / b_thr */

    printf("%s:%d - %s - a_thr:%p - b_thr:%p\n",
           __FILE__,__LINE__,__FUNCTION__,a_thr.p,b_thr.p);

    status = pthread_create(&a_thr, NULL, _thread, (void*) 1 );
    if ( status != 0 ) {
      printf("Failed to create thread 1\n");
      return (-1);
    }

    status = pthread_create(&b_thr, NULL, _thread, (void*) 2 );
    if ( status != 0 ) {
      printf("Failed to create thread 2\n");
      return (-1);
    }

    status = pthread_join(a_thr, NULL);
    if ( status != 0 ) {
      printf("Failed to join thread 1\n");
      return (-1);
    }
    printf("Joined thread1\n");

    status = pthread_join(b_thr, NULL);
    if ( status != 0 ) {
      printf("Failed to join thread 2\n");
      return (-1);
    }
    printf("Joined thread2\n");
  }
#endif // SPAWN_THREADS

  OK = 0;
  // Check that we have OpenMP before declaring things OK formally.
#ifdef _OPENMP
    OK = 1;
    {
      short i;
      for (i=0;i<3;i++) OK &= ThreadOK[i];
    }
    if (OK) printf("OMP : All looks good\n");
    else printf("OMP : Error\n");
#else
    OK = 1;
    printf("OpenMP seems not enabled ...\n");
#endif

  return OK?0:1;
}
コード例 #8
0
void DataTransferAppImpl::AddData(const char* data, const size_t len, const std::string tunnelID ) {
	tunnel_dt_client.AddData(data, len, tunnelID);
	MainThread()->Post(this, APP_SEND, new talk_base::TypedMessageData<std::string>(tunnelID));
}