OperationInterrupter::FunctionHandle OperationInterrupter::addInterruptionFunction(move_function<void()> interruptionFunction)
{
    assert(interruptionFunction
        && "There is no good reason to ever add an Interruption Function that can't be called");
    tbb::spin_mutex::scoped_lock lock(mutex);
    if (interrupted_) {
        //TODO -- Throw rather than calling interruptionFunction (maybe?)
        //(since calls to addInterruptionFunction must be able to handle it throwing anyway)
        interruptionFunction();
        return FunctionHandle();
    }
    interruptionFunctions.push_back(boost::move(interruptionFunction));
    return FunctionHandle(*this, interruptionFunctions.end() - 1);
}
示例#2
0
//********************************************************************************************************
// 函数名称:FunctionHandle
// 输入参数:无
// 输出参数:无
// 功能描述:MODBUS服务函数
//********************************************************************************************************
void IdleModbus(void)
{
	uint8_t err;

	// 检验有效帧
//	OSSemPend(mb_handle_event_ptr,0,&err);

    if(mb_handle_event_flag==1)
	  mb_handle_event_flag=0;
	else
	  return;
	if(PDUData.FrameOK==FALSE)		// 接收帧未结束返回
		return;
	PDUData.FrameOK = FALSE;
	 
	FunctionHandle();				// 功能代码处理函数
	PackPDU2ADU();					// 将PDU帧封装成ADU帧
	TransfersReplyHandle();			// 传输应答帧
	// 准备收到下一帧

//	ADUData.ADUBuffPtr = SlaveDevice.RequestPtr;
	ADUData.ADULength = 0;
	PDUData.PDUBuffPtr = NULL;
}
OperationInterrupter::FunctionHandle NullOperationInterrupter::addInterruptionFunction(move_function<void()> interruptionFunction) {
    assert(interruptionFunction
        && "There is no good reason to ever add an Interruption Function that can't be called");
    
    return FunctionHandle();
}