📄 checkcom.cpp
字号:
//---------------------------------------------------------------------------#include <clx.h>#pragma hdrstop#include "checkcom.h"#include <sys/time.h>#include <sys/types.h>
#include <unistd.h>#include <signal.h>#pragma package(smart_init)//---------------------------------------------------------------------------// Important: Methods and properties of objects in CLX can only be// used in a method called using Synchronize, for example://// Synchronize(&UpdateCaption);//// where UpdateCaption could look like://// void __fastcall TCheckCom::UpdateCaption()// {// Form1->Caption = "Updated in a thread";// }//---------------------------------------------------------------------------int p_com_fd;__fastcall TCheckCom::TCheckCom(bool CreateSuspended) : TThread(CreateSuspended){}//---------------------------------------------------------------------------void __fastcall TCheckCom::Execute(){ fd_set rfd; int max_fd;
while(true)
{
if(Terminated)
break;
FD_ZERO(&rfd);
FD_SET(p_com_fd, &rfd);
max_fd = p_com_fd + 1;
select(max_fd, &rfd, NULL, NULL, NULL);
if(FD_ISSET(p_com_fd, &rfd))
raise(SIGUSR1);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -