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


C++ Synchronize函数代码示例

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


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

示例1: Sleep

//---------------------------------------------------------------------------
void __fastcall TThreadTimer::Execute()
{
Sleep(2000);
for (int i=0; i<5400; i++)
{
        Sleep(1000);
        timecount++;
if (timecount>=0 && timecount<10)
        outtime="0"+AnsiString(timecount);
else if (timecount>=10 && timecount<60)
        outtime=AnsiString(timecount);
else if (timecount>=60)
        {
        timecountmin++;
        timecount=0;
        outtime="0"+AnsiString(timecount);
}

if (timecountmin>=0 && timecountmin<10)
        outtimemin="0"+AnsiString(timecountmin);
else if (timecountmin>=10)
        outtimemin=AnsiString(timecountmin);

        Synchronize(&ShowTimer);
}

Synchronize(OutTimer);

}
开发者ID:unuservize,项目名称:Updater,代码行数:30,代码来源:TimerThread.cpp

示例2: while

//---------------------------------------------------------------------------
void __fastcall TServerConnectionTH::Execute(void)
{
	ReturnValue = -1;
	while(!Terminated) {
		try {
			TBluetoothSocket * ASocket = NULL;
			while((!Terminated) && (ASocket == NULL)) {
				ASocket = FServerSocket->Accept(100);
			}
			ReturnValue = 0;
			if(ASocket != NULL) {
				FSocket = ASocket;
				while (!Terminated){
					FData = ASocket->ReadData();
					if(FData.Length > 0) {
						Synchronize(TThreadMethod);
					}
					Sleep(100);
				}
			}
		} catch (Exception &ex) {
			Msg = ex.Message;
			Synchronize(TThreadMethodException);
		}
    }
}
开发者ID:FMXExpress,项目名称:Firemonkey,代码行数:27,代码来源:Unit1.cpp

示例3: XMLFile

//---------------------------------------------------------------------------
void __fastcall TSendThread::Execute()
{
	SOCKET ConnectSocket;
	int r;

	User = LoginForm->UserEdit->Text;
	Password = LoginForm->PasswordEdit->Text;

	if (ConnectSocket = ConnectToServer(this,  ms, srv))	{
		if (Auth(this, ConnectSocket))	{
			r = XMLFile(this, ConnectSocket, msXML);
			if (r) {
				SendForm->Close();
				ThreadMsg = "Данные успешно переданы.";
				Synchronize(&ShowThreadMessage);
			}
		}
		ShutDownConnection(this, ConnectSocket);
	}
	if (SendForm->Visible == true) {
		ThreadMsg = "Ошибка при передаче данных. Данные не отправлены.";
		Synchronize(&ShowThreadMessage);
	}

	delete msXML;
//	delete ms;
//    SendForm->Close();
	//---- Place thread code here ----
}
开发者ID:IshPeredysh,项目名称:udd,代码行数:30,代码来源:TSendThread.cpp

示例4: while

//---------------------------------------------------------------------------
void __fastcall WriterThread::Execute()
{
   //---- Place thread code here ----
   // sit on WaitForSingleObject, waiting for recorder buffers to be written
   // When write done update write block number

   GJV_thread::setThreadName( "WAV writer" );
   try
   {
      while ( !Terminated )
      {
         if ( WaitForSingleObject( ReleaseWriteEvent, 1000 ) == WAIT_OBJECT_0 )
         {
            // Our event signalled
            while ( WriteBlock < RecordBlock )
            {
               RecBuffer & r = bufflist[ WriteBlock % NBUFFS ];

               if ( r.filled )
               {
                  if ( r.RecBlock != WriteBlock )
                  {
                     Synchronize( &Kill1 );
                     return ;
                  }

#define pttype INT16
                  pttype *q = ( pttype * ) ( r.buff );
                  DDCRET ret = outWave.WriteData ( q, r.Size / 2 );   // size is samples
                  if ( ret != DDC_SUCCESS )
                  {
                     Synchronize( &Kill3 );
                     return ;
                  }
               }
               else
               {
                  Synchronize( &Kill2 );
                  return ;
               }

               r.reset();
               WriteBlock++;
            }
         }
      }
   }
   __finally
   {
      outWave.Close();
   }
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:53,代码来源:WriterThread.cpp

示例5: Header_Begin

//---------------------------------------------------------------------------
bool File_Ogg::Header_Begin()
{
    //Synchro
    if (!Synched && !Synchronize())
        return false;

    //Quick test of synchro
    if (CC4(Buffer+Buffer_Offset)!=Ogg::OggS && !Synchronize())
        return false;

    //All should be OK...
    return true;
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:14,代码来源:File_Ogg.cpp

示例6: CreateEvent

//---------------------------------------------------------------------------
void __fastcall TComPortRd::Execute()
{
        FlCallBlock = false;
        FlCallSend = false;
        OverlapsRD.hEvent = CreateEvent(NULL, true, true, NULL);
        SetCommMask(ComPortRd, EV_RXCHAR);
        while (!Terminated) {
                WaitCommEvent(ComPortRd, &mask, &OverlapsRD);
                signal = WaitForSingleObject(OverlapsRD.hEvent, 1500);
                if (signal==WAIT_OBJECT_0) {
                        if (GetOverlappedResult(ComPortRd, &OverlapsRD, &temp1, true) ) {
                                if ( (mask & EV_RXCHAR) != 0) {
                                        FlCallSend = true;
                                }
                        }
                }
                else {
                        Sleep(20);
                }
                if ( !EventNewDate ) continue;
                if ( FlCallBlock ) continue;
                if (  FlCallSend ) {
                        ClearCommError(ComPortRd, &temp2, &curstat);
                        btr = curstat.cbInQue;
                        if (btr)
                                Synchronize(EventNewDateSynhr);
                        else
                                FlCallSend = false;
                }
        }
        CloseHandle(OverlapsRD.hEvent);
}
开发者ID:PolBadWolf,项目名称:t1_hot_IzmLenSlitkov,代码行数:33,代码来源:ComPort.cpp

示例7: while

//---------------------------------------------------------------------------
bool File_Vc1::Header_Parser_QuickSearch()
{
    while (           Buffer_Offset+4<=Buffer_Size
      &&   CC3(Buffer+Buffer_Offset)==0x000001)
    {
        //Getting start_code
        int8u start_code=CC1(Buffer+Buffer_Offset+3);

        //Searching start
        if (Streams[start_code].Searching_Payload)
            return true;

        //Getting size
        Buffer_Offset+=4;
        while(Buffer_Offset+4<=Buffer_Size && CC3(Buffer+Buffer_Offset)!=0x000001)
        {
            Buffer_Offset+=2;
            while(Buffer_Offset<Buffer_Size && Buffer[Buffer_Offset]!=0x00)
                Buffer_Offset+=2;
            if (Buffer_Offset<Buffer_Size && Buffer[Buffer_Offset-1]==0x00 || Buffer_Offset>=Buffer_Size)
                Buffer_Offset--;
        }
    }

    if (Buffer_Offset+4<=Buffer_Size)
        Trusted_IsNot("VC-1, Synchronisation lost");
    Synched=false;
    return Synchronize();
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:30,代码来源:File_Vc1.cpp

示例8: while

//---------------------------------------------------------------------------
bool File_AvsV::Header_Parser_QuickSearch()
{
    while (       Buffer_Offset+4<=Buffer_Size
      &&   Buffer[Buffer_Offset  ]==0x00
      &&   Buffer[Buffer_Offset+1]==0x00
      &&   Buffer[Buffer_Offset+2]==0x01)
    {
        //Getting start_code
        int8u start_code=Buffer[Buffer_Offset+3];

        //Searching start or timestamp
        if (Streams[start_code].Searching_Payload)
            return true;

        //Synchronizing
        Buffer_Offset+=4;
        Synched=false;
        if (!Synchronize_0x000001())
            return false;
    }

    if (Buffer_Offset+3==Buffer_Size)
        return false; //Sync is OK, but start_code is not available
    Trusted_IsNot("AVS Video, Synchronisation lost");
    return Synchronize();
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:27,代码来源:File_AvsV.cpp

示例9: while

//---------------------------------------------------------------------------
bool File_Dirac::Header_Parser_QuickSearch()
{
    while (       Buffer_Offset+5<=Buffer_Size
      &&   Buffer[Buffer_Offset  ]==0x42
      &&   Buffer[Buffer_Offset+1]==0x42
      &&   Buffer[Buffer_Offset+2]==0x43
      &&   Buffer[Buffer_Offset+3]==0x44) //"BBCD"
    {
        //Getting start_code
        int8u start_code=CC1(Buffer+Buffer_Offset+4);

        //Searching start
        if (Streams[start_code].Searching_Payload)
            return true;

        //Getting size
        Buffer_Offset+=BigEndian2int32u(Buffer+Buffer_Offset+5);
    }

    if (Buffer_Offset+4==Buffer_Size)
        return false; //Sync is OK, but start_code is not available
    if (Buffer_Offset+5<=Buffer_Size)
        Trusted_IsNot("Dirac, Synchronisation lost");
    Synched=false;
    return Synchronize();
}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:27,代码来源:File_Dirac.cpp

示例10: Trusted_IsNot

//---------------------------------------------------------------------------
bool File_Wvpk::Header_Begin()
{
    //Specific cases
    if (FromMKV)
        return true;
        
    if (!File__Tags_Helper::Header_Begin())
        return false;

    //Must have enough buffer for having header
    if (Buffer_Offset+4>Buffer_Size)
        return false;

    //Quick test of synchro
    if (Synched && CC4(Buffer+Buffer_Offset)!=CC4("wvpk"))
    {
        Trusted_IsNot("WavPack, Synchronisation lost");
        Synched=false;
    }

    //Synchro
    if (!Synched && !Synchronize())
        return false;

    return true;
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:27,代码来源:File_Wvpk.cpp

示例11: Synchronize

//---------------------------------------------------------------------------
void CTerminalRobotTyper::HandleTicketStub(){
	//向服务器后台提交修改本张票的打印状态,非本地文件出票,上传后台
	Ticket *currentTicket =(Ticket *)terminal->currentRequest;
	if (currentTicket->fileData){
		//发票任务需要等待一会,等终端机复位或者界面切换,也就是下边的代码执行完
		controller->fileDataDealer->NotifyPrint(terminal);
	}else{
		bool success =terminal->connection->ReplyStub(terminal->currentStub);
		if (!success) {
			controller->AddErrorMessage("终端" +terminal->xmlConfig->TerminalID +"已正常出票,但向后台提交票根时网络错误,票号:" +IntToStr(currentTicket->id) +",请注意出票是否正常。");
			terminal->connection->DisConnect();     //等待下次重新发过来,从票根文件中上传吧
		}
	}
	//统计数据更新,包括在线的和本地的
	terminal->monitor->ticketCount ++;
	terminal->monitor->ticketMoney +=currentTicket->amount;
	//切换当前与上一注记录
	terminal->lastStake =terminal->currentStake;	//默认切换
	//看打印完后的界面,是否自动转到另一投注方式的起始位置,如果是的话就自动转过去
	if (terminal->currentStake->HasAttribute("FinishedNode") && terminal->currentStake->FinishedNode!="") {
		terminal->lastStake =terminal->findStakeByNode(terminal->currentStake->FinishedNode);
	}
	//往下挪一行
	Synchronize(& terminal->panel->GridInsertNewDataLine);
}
开发者ID:limitee,项目名称:bot,代码行数:26,代码来源:TerminalRobotTyper.cpp

示例12: Info

//---------------------------------------------------------------------------
bool File_Dts::Header_Begin()
{
    //Must have enough buffer for having header
    if (Buffer_Offset+4>Buffer_Size)
        return false;

    //DTS-HD: Saving offset
    size_t DTS_HD_Offset=Buffer_Offset;

    //Quick test of synchro
    if (Synched && CC4(Buffer+Buffer_Offset)!=SyncCode)
    {
        Info("DTS, Synchronisation lost"); //Should not //TODO: find a better way to detect DTS
        Synched=false;
    }

    //Synchro
    if (!Synched && !Synchronize())
        return false;

    //DTS-HD: Saving difference
    if (Buffer_Offset-DTS_HD_Offset && Frame_Count>0)
        DTS_HD_Unknown_Size=Buffer_Offset-DTS_HD_Offset;

    //All should be OK...
    return true;
}
开发者ID:thespooler,项目名称:mediainfo-code,代码行数:28,代码来源:File_Dts.cpp

示例13: while

//---------------------------------------------------------------------------
void __fastcall TPS2_REC::Execute()
{
   //---- Place thread code here ----
   while(!Terminated)
   {
      Synchronize(Show_ASCII);
   }
}
开发者ID:carriercomm,项目名称:z80control,代码行数:9,代码来源:PS2_Thread.cpp

示例14: ShowMessage

void TProgressThread::Result(int res)
{
 ShowMessage(AnsiString(res));
 while(res<=count){
                                 summary=(res*100)/count;
                                 Synchronize(&TLabelProcess);
        }
}
开发者ID:unuservize,项目名称:Updater,代码行数:8,代码来源:TProgressThread.cpp

示例15: Work

    virtual void Work()
    {
        // Open a database
        GetViewerMethods()->InvertBackgroundColor();
        GetViewerMethods()->OpenDatabase("/usr/gapps/visit/data/noise.silo");
        Synchronize();

        // Create a plot and draw it.
        int plotType = PlotIndex("Pseudocolor");
        if(plotType != INVALID_PLUGIN_INDEX)
        {
            debug1 << "Plot type = " << plotType << endl;
            GetViewerMethods()->AddPlot(plotType, "hardyglobal");
      
            int threeSlice = OperatorIndex("ThreeSlice");
            if(threeSlice != INVALID_PLUGIN_INDEX)
                GetViewerMethods()->AddOperator(threeSlice);
            GetViewerMethods()->DrawPlots();
        }
        Synchronize();

        // Save an image.
        GetViewerMethods()->SaveWindow();

        // Set some pseudocolor plot attributes using the base class'
        // SetValue methods.
        AttributeSubject *pcAtts = GetViewerState()->GetPlotAttributes(plotType);
        if(pcAtts != 0)
        {
            pcAtts->SetValue("min", 1.5);
            pcAtts->SetValue("minFlag", true);
            pcAtts->SetValue("max", 4.5);
            pcAtts->SetValue("maxFlag", true);
            pcAtts->SetValue("colorTableName", "calewhite");
            pcAtts->Notify();
            GetViewerMethods()->SetPlotOptions(plotType);
        }

        // Save an image.
        GetViewerMethods()->SaveWindow();

        // Enter an event loop so the program keeps running and we can
        // interact with the viewer.
        EventLoop();
    }
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:45,代码来源:proxyexample.C


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