本文整理汇总了C++中setTimeout函数的典型用法代码示例。如果您正苦于以下问题:C++ setTimeout函数的具体用法?C++ setTimeout怎么用?C++ setTimeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTimeout函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setPortName
/*!
\fn Win_QextSerialPort::Win_QextSerialPort(const QString & name, const PortSettings& settings)
Constructs a port with specified name and settings.
*/
Win_QextSerialPort::Win_QextSerialPort(const QString & name, const PortSettings& settings, QextSerialBase::QueryMode mode)
{
m_WinHandle=INVALID_HANDLE_VALUE;
setPortName(name);
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setStopBits(settings.StopBits);
setParity(settings.Parity);
setFlowControl(settings.FlowControl);
setTimeout(settings.Timeout_Millisec);
setQueryMode(mode);
init();
}
开发者ID:dulton,项目名称:53_hero,代码行数:17,代码来源:win_qextserialport.cpp
示例2: handleRead
/// Handle completion of a read operation.
void handleRead( const boost::system::error_code& e, std::size_t bytesTransferred )
{
setTimeout( 0 );
if ( !e ) {
LOG_TRACE << "Read " << bytesTransferred << " bytes from " << identifier();
m_connHandler->networkInput( m_readBuffer, bytesTransferred );
}
else {
LOG_TRACE << "Read error: " << e.message();
signalError( e );
}
nextOperation();
}
开发者ID:Wolframe,项目名称:Wolframe,代码行数:14,代码来源:connectionBase.hpp
示例3: handleShutdown
/// Handle connection shutdown
void handleShutdown()
{
setTimeout( 0 );
if ( socket().lowest_layer().is_open() ) {
boost::system::error_code ignored_ec;
socket().lowest_layer().shutdown( boost::asio::ip::tcp::socket::shutdown_both, ignored_ec );
socket().lowest_layer().close();
LOG_DEBUG << "Connection to " << identifier() << " closed";
}
else {
LOG_DEBUG << "Connection to " << identifier() << " already closed";
}
}
开发者ID:Wolframe,项目名称:Wolframe,代码行数:14,代码来源:connectionBase.hpp
示例4: QextSerialBase
/*!
\fn Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings)
Constructs a port with default name and specified settings.
*/
Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings, QextSerialBase::QueryMode mode)
: QextSerialBase()
{
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setParity(settings.Parity);
setStopBits(settings.StopBits);
setFlowControl(settings.FlowControl);
setTimeout(settings.Timeout_Millisec);
setQueryMode(mode);
init();
}
开发者ID:MatthiasEgli,项目名称:qgroundcontrol,代码行数:17,代码来源:posix_qextserialport.cpp
示例5: QextSerialBase
/*!
\fn Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings)
Constructs a port with default name and specified settings.
*/
Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings)
: QextSerialBase()
{
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setParity(settings.Parity);
setStopBits(settings.StopBits);
setFlowControl(settings.FlowControl);
Posix_File=new QFile();
setTimeout(settings.Timeout_Millisec);
init();
}
开发者ID:bcabebe,项目名称:Serial-Bootloader-AN1310-v1.05,代码行数:17,代码来源:posix_qextserialport.cpp
示例6: QIODevice
/*!
Constructs a port with default name and specified settings.
*/
QextSerialPort::QextSerialPort(const PortSettings & settings, QextSerialPort::QueryMode mode)
: QIODevice()
{
construct();
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setParity(settings.Parity);
setStopBits(settings.StopBits);
setFlowControl(settings.FlowControl);
setTimeout(settings.Timeout_Millisec);
setQueryMode(mode);
platformSpecificInit();
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:16,代码来源:qextserialport.cpp
示例7: port
/*!
* initPort() - initialization of com port.
*/
void TEDisplayEpson::initPort()
{
TSerialPort *p = port();
if ( !p ) return;
if (!isOpen())
open();
p->setFlowControl(FLOW_OFF);
setPortBaudRate(m_baudRate);
p->setDataBits(DATA_8);
p->setParity(PAR_NONE);
p->setStopBits(STOP_1);
setTimeout(100);
};
开发者ID:app,项目名称:tradeequip-drv,代码行数:16,代码来源:epson.cpp
示例8: rfid_set
void ICACHE_FLASH_ATTR rfid_set(uint8 freq, uint8 led) {
char command[10];
if (freq < 10) {
os_sprintf(command, "mc%d0\r", freq);
uart_write_str(command);
#if RFID_DEBUG
debug("RFID: %s\n", command);
#endif
}
setTimeout(rfid_set_led, led, 10);
}
开发者ID:timmyhadwen,项目名称:ESP8266,代码行数:13,代码来源:mod_rfid.c
示例9: finger_start_read
LOCAL void ICACHE_FLASH_ATTR finger_start_read() {
LOCAL uint32 finger_read_timer = 0;
if (device_get_uart() != UART_FINGER) {
#if FINGER_DEBUG
debug("FINGER: %s\n", DEVICE_NOT_FOUND);
#endif
return;
}
finger_current_buff = 0;
clearTimeout(finger_read_timer);
finger_read_timer = setTimeout(finger_gen_img, finger_read, FINGER_TIMEOUT);
}
开发者ID:habashynn,项目名称:ESP8266,代码行数:13,代码来源:user_mod_finger.c
示例10: PPositionOurGoalKick
inline PPositionOurGoalKick(const BeliefState& state)
: Play(state)
{
name = "PositionOurGoalKick";
assert(HomeTeam::SIZE == 5);
setTimeout(100, 1);
PositionPlay = PLAYTYPE_YES;
AttackPlay = PLAYTYPE_NO;
Tactic::Param param;
Vector2D<int> finalPoint ;
/* for goalie */
roleList[0].push_back(std::make_pair(Tactic::GoalieOur, param));
/*Vector2D<int> dpointg(ForwardX(-HALF_FIELD_MAXX + GOAL_DEPTH + BOT_RADIUS*1.2),state.ballPos.y);
param.PositionP.x = ForwardX(-HALF_FIELD_MAXX + GOAL_DEPTH + BOT_RADIUS*1.2) ;
param.PositionP.y = state.ballPos.y;
param.PositionP.finalSlope = 0;
param.PositionP.align = false ;
roleList[0].push_back(std::make_pair(Tactic::Position,param));
*//* Role 1 - Defender 1*/
Vector2D<int> dpoint0(ForwardX(-HALF_FIELD_MAXX + GOAL_DEPTH + BOT_RADIUS*9),-1*(OUR_GOAL_MAXY + 2*BOT_RADIUS));
finalPoint = position_our_bot(&state,dpoint0,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0 ;
roleList[1].push_back(std::make_pair(Tactic::Position,param));
// Role 2
Vector2D<int> dpoint(ForwardX(-HALF_FIELD_MAXX/2),HALF_FIELD_MAXY/2);
finalPoint = position_our_bot(&state,dpoint,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0;
roleList[2].push_back(std::make_pair(Tactic::Position, param));
//Role 3
Vector2D<int> dpoint1(ForwardX(-CENTER_CIRCLE_DIAMETER/2),HALF_FIELD_MAXY/4);
finalPoint = position_our_bot(&state,dpoint1,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0;
roleList[3].push_back(std::make_pair(Tactic::Position, param));
//Role 4
Vector2D<int> dpoint2(ForwardX(HALF_FIELD_MAXX/6),-HALF_FIELD_MAXY/2);
finalPoint = position_our_bot(&state,dpoint2,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0;
roleList[4].push_back(std::make_pair(Tactic::Position, param));
computeMaxTacticTransits();
}
开发者ID:KRSSG,项目名称:kgpkubs-mirosot,代码行数:51,代码来源:pPositionOurGoalKick.hpp
示例11: Packet
VotePacket::VotePacket( uint32 ip, uint16 port, int32 rank,
bool direct)
: Packet( MAX_VOTE_LENGTH,
VOTE_PRIO,
PACKETTYPE_VOTE,
ip, port, 0, 0)
{
int packetPosition = HEADER_SIZE;
incWriteLong( packetPosition, rank );
incWriteLong( packetPosition, direct );
// 5 seconds timeout.
setTimeout( 5 );
setLength(packetPosition);
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:14,代码来源:ModulePacket.cpp
示例12: File
Socket::Socket(int sockfd, int type, const char *address /* = NULL */,
int port /* = 0 */)
: File(true), m_port(port), m_type(type), m_error(0), m_eof(false),
m_timeout(0), m_timedOut(false), m_bytesSent(0) {
if (address) m_address = address;
m_fd = sockfd;
struct timeval tv;
tv.tv_sec = RuntimeOption::SocketDefaultTimeout;
tv.tv_usec = 0;
setsockopt(m_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(m_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
setTimeout(tv);
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:14,代码来源:socket.cpp
示例13: cancel
void Timer::start(TimeMs timeout, Qt::TimerType type, Repeat repeat) {
cancel();
_type = type;
setRepeat(repeat);
_adjusted = false;
setTimeout(timeout);
_timerId = startTimer(_timeout, _type);
if (_timerId) {
_next = getms(true) + _timeout;
} else {
_next = 0;
}
}
开发者ID:absalan,项目名称:tdesktop,代码行数:14,代码来源:timer.cpp
示例14: setTimeout
void
StopAndWaitRC::doWakeup(Port<Data>)
{
if (sendNowData &&
getPortConnector< Port<Data> >()->hasAcceptor(activeCompound))
{
setTimeout(resendTimeout);
getPortConnector< Port<Data> >()->getAcceptor(activeCompound)->sendData(activeCompound->copy());
sendNowData = false;
}
getReceptor()->wakeup();
}
开发者ID:freiheitsnetz,项目名称:openwns-library,代码行数:14,代码来源:StopAndWaitRC.cpp
示例15: settings
/*!
\fn Posix_QextSerialPort::construct(void)
Common constructor function, called by all versions of
Posix_QextSerialPort::Posix_QextSerialPort(). Sets up default port settings (115200 8N1
Hardware flow control where supported, otherwise no flow control, and 500 ms timeout).
*/
void Posix_QextSerialPort::construct(void) {
QextSerialBase::construct();
#ifdef NOQFILE
m_fdFile=-1;
#else
Posix_File=new QFile();
#endif
setBaudRate(BAUD115200);
setDataBits(DATA_8);
setStopBits(STOP_1);
setParity(PAR_NONE);
setFlowControl(FLOW_HARDWARE);
setTimeout(0, 500);
}
开发者ID:app,项目名称:tradeequip,代码行数:20,代码来源:posix_qextserialport.cpp
示例16: if
void ExtWorkerConfig::config(const XmlNode *pNode)
{
const char *pValue;
int iMaxConns = ConfigCtx::getCurConfigCtx()->getLongValue(pNode,
"maxConns", 1, 2000, 1);
int iRetryTimeout = ConfigCtx::getCurConfigCtx()->getLongValue(pNode,
"retryTimeout", 0, LONG_MAX, 10);
int iInitTimeout = ConfigCtx::getCurConfigCtx()->getLongValue(pNode,
"initTimeout", 1, LONG_MAX, 3);
int iBuffer = ConfigCtx::getCurConfigCtx()->getLongValue(pNode,
"respBuffer", 0, 2, 1);
int iKeepAlive = ConfigCtx::getCurConfigCtx()->getLongValue(pNode,
"persistConn", 0, 1, 1);
int iKeepAliveTimeout = ConfigCtx::getCurConfigCtx()->getLongValue(pNode,
"pcKeepAliveTimeout", -1, INT_MAX, INT_MAX);
if (iKeepAliveTimeout == -1)
iKeepAliveTimeout = INT_MAX;
if (iBuffer == 1)
iBuffer = 0;
else if (iBuffer == 0)
iBuffer = HEC_RESP_NOBUFFER;
else if (iBuffer == 2)
iBuffer = HEC_RESP_NPH;
setPersistConn(iKeepAlive);
setKeepAliveTimeout(iKeepAliveTimeout);
setMaxConns(iMaxConns);
setTimeout(iInitTimeout);
setRetryTimeout(iRetryTimeout);
setBuffering(iBuffer);
clearEnv();
const XmlNodeList *pList = pNode->getChildren("env");
if (pList)
{
XmlNodeList::const_iterator iter;
for (iter = pList->begin(); iter != pList->end(); ++iter)
{
pValue = (*iter)->getValue();
if (pValue)
addEnv((*iter)->getValue());
}
}
}
开发者ID:52M,项目名称:openlitespeed,代码行数:49,代码来源:extworkerconfig.cpp
示例17: socket
bool Socket::connect(SockAddr& remote) {
_remote = remote;
_fd = socket(remote.getType(), SOCK_STREAM, 0);
if (_fd == INVALID_SOCKET) {
LOG(_logLevel) << "ERROR: connect invalid socket " << errnoWithDescription();
return false;
}
if (_timeout > 0) {
setTimeout(_timeout);
}
static const unsigned int connectTimeoutMillis = 5000;
ConnectBG bg(_fd, remote);
bg.go();
if (bg.wait(connectTimeoutMillis)) {
if (bg.inError()) {
warning() << "Failed to connect to " << _remote.getAddr() << ":" << _remote.getPort()
<< ", reason: " << bg.getErrnoWithDescription();
close();
return false;
}
} else {
// time out the connect
close();
bg.wait(); // so bg stays in scope until bg thread terminates
warning() << "Failed to connect to " << _remote.getAddr() << ":" << _remote.getPort()
<< " after " << connectTimeoutMillis << " milliseconds, giving up.";
return false;
}
if (remote.getType() != AF_UNIX)
disableNagle(_fd);
#ifdef SO_NOSIGPIPE
// ignore SIGPIPE signals on osx, to avoid process exit
const int one = 1;
setsockopt(_fd, SOL_SOCKET, SO_NOSIGPIPE, &one, sizeof(int));
#endif
_local = getLocalAddrForBoundSocketFd(_fd);
_fdCreationMicroSec = curTimeMicros64();
_awaitingHandshake = false;
return true;
}
开发者ID:judahschvimer,项目名称:mongo,代码行数:49,代码来源:sock.cpp
示例18: setTimeout
void ASIOConnection::refresh(Milliseconds timeout, RefreshCallback cb) {
_impl->strand().dispatch([this, timeout, cb] {
auto op = _impl.get();
// We clear state transitions because we're re-running a portion of the asio state machine
// without entering in startCommand (which would call this for us).
op->clearStateTransitions();
_refreshCallback = std::move(cb);
// Actually timeout refreshes
setTimeout(timeout, [this] { _impl->connection().stream().cancel(); });
// Our pings are isMaster's
auto beginStatus = op->beginCommand(makeIsMasterRequest(this),
NetworkInterfaceASIO::AsyncCommand::CommandType::kRPC,
_hostAndPort);
if (!beginStatus.isOK()) {
auto cb = std::move(_refreshCallback);
cb(this, beginStatus);
return;
}
// If we fail during refresh, the _onFinish function of the AsyncOp will get called. As such
// we
// need to intercept those calls so we can capture them. This will get cleared out when we
// fill
// in the real onFinish in startCommand.
op->setOnFinish([this](StatusWith<RemoteCommandResponse> failedResponse) {
invariant(!failedResponse.isOK());
auto cb = std::move(_refreshCallback);
cb(this, failedResponse.getStatus());
});
op->_inRefresh = true;
_global->_impl->_asyncRunCommand(op, [this, op](std::error_code ec, size_t bytes) {
cancelTimeout();
auto cb = std::move(_refreshCallback);
if (ec)
return cb(this, Status(ErrorCodes::HostUnreachable, ec.message()));
op->_inRefresh = false;
cb(this, Status::OK());
});
});
}
开发者ID:DreamerKing,项目名称:mongo,代码行数:49,代码来源:connection_pool_asio.cpp
示例19: main
int main() {
#if FIRST
FILE *f = fopen("waka.txt", "w");
fputc('a', f);
fputc('z', f);
fclose(f);
EM_ASM(
FS.saveFilesToDB(['waka.txt', 'moar.txt'], function() {
Module.print('save ok');
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost:8888/report_result?1');
xhr.send();
setTimeout(function() { window.close() }, 1000);
}, function(e) {
开发者ID:0u812,项目名称:emscripten,代码行数:15,代码来源:file_db.cpp
示例20: get
void HttpService::get(
const std::string& uri,
std::function<void(bool, const std::vector<std::uint8_t>&)> callback)
{
auto request = std::make_unique<HttpRequest>(uri, callback);
if (timeout > decltype(timeout)::zero()) {
request->setTimeout(timeout);
}
auto result = curl_multi_add_handle(multiHandle, request->getCurl());
if (result != CURLE_OK) {
throw std::runtime_error("curl_multi_add_handle() failed");
}
sessions.emplace(request->getCurl(), std::move(request));
}
开发者ID:colajam93,项目名称:daily-snippets,代码行数:15,代码来源:HttpService.cpp
注:本文中的setTimeout函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论