当前位置: 首页>>代码示例>>C++>>正文


C++ wxMilliSleep函数代码示例

本文整理汇总了C++中wxMilliSleep函数的典型用法代码示例。如果您正苦于以下问题:C++ wxMilliSleep函数的具体用法?C++ wxMilliSleep怎么用?C++ wxMilliSleep使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wxMilliSleep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DisconnectWithAlert

bool Camera_OpticstarPL130Class::Capture(int duration, usImage& img, int options, const wxRect& subframe)
{
    bool still_going = true;

    int mode = 3 * (int) Color;
    if (img.Init(FullSize))
    {
        DisconnectWithAlert(CAPT_FAIL_MEMORY);
        return true;
    }
    if (OSPL130_Capture(mode,duration)) {
        pFrame->Alert(_("Cannot start exposure"));
        return true;
    }
    if (duration > 100) {
        wxMilliSleep(duration - 100); // wait until near end of exposure, nicely
        wxGetApp().Yield();
//      if (Abort) {
//          MeadeCam->AbortImage();
//          return true;
//      }
    }
    while (still_going) {  // wait for image to finish and d/l
        wxMilliSleep(20);
        OSPL130_IsExposing(&still_going);
        wxGetApp().Yield();
    }
    // Download
    OSPL130_GetRawImage(0,0,FullSize.GetWidth(),FullSize.GetHeight(), (void *) img.ImageData);
    unsigned short *dataptr;
    dataptr = img.ImageData;
    // byte swap

    if (options & CAPTURE_SUBTRACT_DARK) SubtractDark(img);
    if (Color && (options & CAPTURE_RECON))
        QuickLRecon(img);

    return false;
}
开发者ID:knro,项目名称:phd2,代码行数:39,代码来源:cam_OSPL130.cpp

示例2: wxMilliSleep

wxThread::ExitCode MyJoinableThread::Entry()
{
    unsigned long res = 1;
    for ( size_t n = 1; n < m_n; n++ )
    {
        res *= n;

        // it's a loooong calculation :-)
        wxMilliSleep(100);
    }

    return (ExitCode)res;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:13,代码来源:misc.cpp

示例3: wxMilliSleep

bool wxLuaDebugTarget::IsConnected(bool wait_for_connect) const
{
    if (m_fConnected || !wait_for_connect) return m_fConnected;

    for (int idx = 0; idx < WXLUASOCKET_CONNECT_TIMEOUT; ++idx)
    {
        if (m_fConnected)
            break;

        wxMilliSleep(100);
    }
    return m_fConnected;
}
开发者ID:henryfung01,项目名称:GameCode4,代码行数:13,代码来源:wxldtarg.cpp

示例4: while

/// Gets a new list of devices by terminating and restarting portaudio
/// Assumes that DeviceManager is only used on the main thread.
void DeviceManager::Rescan()
{
   // get rid of the previous scan info
   this->mInputDeviceSourceMaps.clear();
   this->mOutputDeviceSourceMaps.clear();

   // if we are doing a second scan then restart portaudio to get new devices
   if (m_inited) {
      // check to see if there is a stream open - can happen if monitoring,
      // but otherwise Rescan() should not be available to the user.
      if (gAudioIO) {
         if (gAudioIO->IsMonitoring()) 
         {
            gAudioIO->StopStream();
            while (gAudioIO->IsBusy())
               wxMilliSleep(100);
         }
      }
      
      // restart portaudio - this updates the device list
      Pa_Terminate();
      Pa_Initialize();
   }

   int nDevices = Pa_GetDeviceCount();

   //The heirarchy for devices is Host/device/source.
   //Some newer systems aggregate this.
   //So we need to call port mixer for every device to get the sources
   for (int i = 0; i < nDevices; i++) {
      const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
      if (info->maxOutputChannels > 0) {
         AddSources(i, info->defaultSampleRate, &mOutputDeviceSourceMaps, 0);
      }

      if (info->maxInputChannels > 0) {
         AddSources(i, info->defaultSampleRate, &mInputDeviceSourceMaps, 1);
      }
   }

   // If this was not an initial scan update each device toolbar.
   // Hosts may have disappeared or appeared so a complete repopulate is needed.
   if (m_inited) {
      DeviceToolBar *dt;
      for (size_t i = 0; i < gAudacityProjects.GetCount(); i++) {
         dt = gAudacityProjects[i]->GetDeviceToolBar();
         dt->RefillCombos();
      }
   }
	m_inited = true;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:53,代码来源:DeviceManager.cpp

示例5: wxMilliSleep

/** \brief Worker method of the Squidd.io server communication thread
 *
 * \return void*
 *
 */   
void *SquiddioThread::Entry()
{
    wxMilliSleep(500); //Give everything some time to settle down before we try to do our work
    m_pHandler->SetThreadRunning(true);
    while (!TestDestroy())
    {
        if( !m_bIsWorking )
        {
            m_bIsWorking = true;
            if( m_getdata )
            {
                m_getdata = false;
                m_pHandler->RefreshLayer();
                SquiddioEvent evt;
                m_pHandler->AddPendingEvent(evt);
            }
            else if ( m_bCheckOnline )
            {
                m_pHandler->CheckIsOnline();
                m_bCheckOnline = false;
            }
            else if ( m_bPositionReport )
            {
                //TODO: Separate from logwindow first.
                m_bPositionReport = false;
            }
            m_bIsWorking = false;
        }
        wxMilliSleep(250);
    }
    // signal the event handler that this thread is going to be destroyed
    // NOTE: here we assume that using the m_pHandler pointer is safe,
    // (in this case this is assured by the MyFrame destructor)
    //    wxQueueEvent(m_pHandler, new wxThreadEvent(wxEVT_COMMAND_DBTHREAD_COMPLETED));
    //return (wxThread::ExitCode)0; // success

    return 0;
}
开发者ID:bdbcat,项目名称:squiddio_pi,代码行数:43,代码来源:squiddio_pi_thread.cpp

示例6: NotifyExit

void wxLuaDebugTarget::Stop()
{
    NotifyExit();

    if (m_fConnected)
    {
        m_clientSocket.Shutdown(SD_BOTH);
        wxMilliSleep(100);
        m_clientSocket.Close();
    }

    if (m_pThread)
        m_pThread->Wait();
}
开发者ID:henryfung01,项目名称:GameCode4,代码行数:14,代码来源:wxldtarg.cpp

示例7: while

// This function performs the main work of the service. 
// When this function returns the service has stopped.
void wxGISNTService::Run()
{
	wxCmdLineParser parser;
	if(!m_Server.Start(wxT("wxGISServer"), CONFIG_DIR, parser)) 
	{
        m_Server.Stop();
		return;
	}

    while (m_bIsRunning)
        wxMilliSleep(300);

	m_Server.Stop();
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:16,代码来源:service.cpp

示例8: OnIdle

	virtual void OnIdle(wxIdleEvent& event)
	{
		if(OpQuit())
		{
			GetParent()->Close(true);
			return;
		}
		Handler()->OnLoop();
		OnLoopSound();
		Refresh(false);
		if(!Handler()->FullSpeed())
			wxMilliSleep(3);
		event.RequestMore();
	}
开发者ID:alexfreud,项目名称:unreal-speccy-portable,代码行数:14,代码来源:main_wx.cpp

示例9: while

void Parser::TerminateAllThreads()
{
    while (!m_PoolTask.empty())
    {
        PTVector& v = m_PoolTask.front();
        for (PTVector::iterator it = v.begin(); it != v.end(); ++it)
            delete *it;
        m_PoolTask.pop();
    }

    m_Pool.AbortAllTasks();
    while (!m_Pool.Done())
        wxMilliSleep(1);
}
开发者ID:stahta01,项目名称:codeblocks_r7456,代码行数:14,代码来源:parser.cpp

示例10: while

void ManagedThread::abort_all()
{
    // 1) Send signal to threads telling to terminate ASAP
    if(count_running() > 0)
    {
        ManagedThread::s_abort_all = true;
        while(count_running() > 0)
        {
            wxMilliSleep(5);
        }
        wxMilliSleep(50);

        // (there's a tiny delay between the thread disminishing the count
        // and the thread actually stopping)
        // 50 ms should be more than enough
    }

    // 2) Delete thread objects
    ManagedThread *thread;
    for(unsigned int i = 0; i < count_threads();++i)
    {
        thread = GetThread(i);
        if(thread)
        {
            if(thread->IsAlive())
                { thread->Delete(); }
            delete thread;
        }
    }

    // 3) Clear thread list
    wxCriticalSectionLocker lock(ManagedThread::s_list_mutex);
    s_threadslist.Clear();

    // 4) Reset the abort flag now that no threads are running
    ManagedThread::s_abort_all = false;
}
开发者ID:stahta01,项目名称:codeAdapt_IDE,代码行数:37,代码来源:managedthread.cpp

示例11: GetActiveProject

///Runs the wait for start dialog.  Returns false if the user clicks stop while we are recording
///so that the high
bool TimerRecordDialog::RunWaitDialog()
{
   int updateResult = eProgressSuccess;
   if (m_DateTime_Start > wxDateTime::UNow()) 
      updateResult = this->WaitForStart(); 

   if (updateResult != eProgressSuccess) 
   {
      // Don't proceed, but don't treat it as canceled recording. User just canceled waiting. 
      return true;
   }
   else 
   {
      // Record for specified time.
      AudacityProject* pProject = GetActiveProject();
      pProject->OnRecord();
      bool bIsRecording = true;

      wxString strMsg =
         _("Recording start") + (wxString)wxT(":\t\t")
         + GetDisplayDate(m_DateTime_Start) + wxT("\n") + _("Recording end")
         + wxT(":\t\t") + GetDisplayDate(m_DateTime_End) + wxT("\n")
         + _("Duration") + wxT(":\t\t") + m_TimeSpan_Duration.Format(); 

      TimerProgressDialog 
         progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(), 
                  _("Audacity Timer Record Progress"), 
                  strMsg, 
                  pdlgHideCancelButton); 

      // Make sure that start and end time are updated, so we always get the full 
      // duration, even if there's some delay getting here.
      wxTimerEvent dummyTimerEvent;
      this->OnTimer(dummyTimerEvent);

      // Loop for progress display during recording.
      while (bIsRecording && (updateResult == eProgressSuccess)) 
      {
         wxMilliSleep(kTimerInterval);
         updateResult = progress.Update();
         bIsRecording = (wxDateTime::UNow() <= m_DateTime_End); // Call UNow() again for extra accuracy...
      }
      pProject->OnStop();
   }
   // Let the caller handle cancellation or failure from recording progress. 
   if (updateResult == eProgressCancelled || updateResult == eProgressFailed)
      return false;
   return true;
}
开发者ID:Cactuslegs,项目名称:audacity-of-nope,代码行数:51,代码来源:TimerRecordDialog.cpp

示例12: columns

ProgressResult TimerRecordDialog::WaitForStart()
{
   // MY: The Waiting For Start dialog now shows what actions will occur after recording has completed
   wxString sPostAction = m_pTimerAfterCompleteChoiceCtrl->GetString(m_pTimerAfterCompleteChoiceCtrl->GetSelection());

   // Two column layout.
   TimerProgressDialog::MessageTable columns(2);
   auto &column1 = columns[0];
   auto &column2 = columns[1];

   column1.push_back(_("Waiting to start recording at:"));
   column2.push_back(GetDisplayDate(m_DateTime_Start));

   column1.push_back(_("Recording duration:"));
   column2.push_back(m_TimeSpan_Duration.Format());

   column1.push_back(_("Scheduled to stop at:"));
   column2.push_back(GetDisplayDate(m_DateTime_End));

   column1.push_back( {} );
   column2.push_back( {} );

   column1.push_back(_("Automatic Save enabled:"));
   column2.push_back((m_bAutoSaveEnabled ? _("Yes") : _("No")));

   column1.push_back(_("Automatic Export enabled:"));
   column2.push_back((m_bAutoExportEnabled ? _("Yes") : _("No")));

   column1.push_back(_("Action after Timer Recording:"));
   column2.push_back(sPostAction);

   wxDateTime startWait_DateTime = wxDateTime::UNow();
   wxTimeSpan waitDuration = m_DateTime_Start - startWait_DateTime;
   TimerProgressDialog progress(waitDuration.GetMilliseconds().GetValue(),
      _("Audacity Timer Record - Waiting for Start"),
      columns,
      pdlgHideStopButton | pdlgConfirmStopCancel | pdlgHideElapsedTime,
      _("Recording will commence in:"));

   auto updateResult = ProgressResult::Success;
   bool bIsRecording = false;
   while (updateResult == ProgressResult::Success && !bIsRecording)
   {
      updateResult = progress.UpdateProgress();
      wxMilliSleep(10);
      bIsRecording = (m_DateTime_Start <= wxDateTime::UNow());
   }
   return updateResult;
}
开发者ID:MindFy,项目名称:audacity,代码行数:49,代码来源:TimerRecordDialog.cpp

示例13: while

wxThread::ExitCode Timer::Entry()
{
    // here we do our long task, periodically calling TestDestroy():
    while (_running && !GetThread()->TestDestroy())
    {
        wxMilliSleep(_ms);
        if (_running)
        {
            wxQueueEvent(_parent->GetEventHandler(), new wxCommandEvent(UpdateEvent)); //new wxTimerEvent());
        }
    }
    // TestDestroy() returned true (which means the main thread asked us
    // to terminate as soon as possible) or we ended the long task...
    return (wxThread::ExitCode)0;
}
开发者ID:JochenKempfle,项目名称:MoCap,代码行数:15,代码来源:Timer.cpp

示例14: MyDetachedThread

void MiscThreadTestCase::TestThreadDelete()
{
    // FIXME:
    // As above, using Sleep() is only for testing here - we must use some
    // synchronisation object instead to ensure that the thread is still
    // running when we delete it - deleting a detached thread which already
    // terminated will lead to a crash!

    MyDetachedThread *thread0 = new MyDetachedThread(30, 'W');
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_MISC_ERROR, thread0->Delete() );    
        // delete a thread which didn't start to run yet.

    MyDetachedThread *thread1 = new MyDetachedThread(30, 'Y');
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread1->Run() );
    wxMilliSleep(300);
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread1->Delete() );      
        // delete a running thread

    MyDetachedThread *thread2 = new MyDetachedThread(30, 'Z');
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread2->Run() );
    wxMilliSleep(300);
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread2->Pause() );
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread2->Delete() );      
        // delete a sleeping thread

    MyJoinableThread thread3(20);
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread3.Run() );
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread3.Delete() );       
        // delete a joinable running thread

    MyJoinableThread thread4(2);
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread4.Run() );
    wxMilliSleep(300);
    CPPUNIT_ASSERT_EQUAL( wxTHREAD_NO_ERROR, thread4.Delete() );       
        // delete a joinable thread which already terminated
}
开发者ID:beanhome,项目名称:dev,代码行数:36,代码来源:misc.cpp

示例15: while

bool GlobalConfig::stopAudioThread()
{
    if( m_AudioThread && m_AudioThread->IsRunning() )
    {
        m_AudioThread->terminate();
        while( m_AudioThread->IsRunning() )
        {
            wxMilliSleep( 100 );
        }
    }

    m_LoggingWindow->Close();
    m_LoggingWindow->Destroy();

    return( false );
}
开发者ID:pc1cp,项目名称:pappsdr,代码行数:16,代码来源:config.cpp


注:本文中的wxMilliSleep函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。