您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ yEnterCriticalSection函数代码示例

51自学网 2021-06-03 11:54:00
  C++
这篇教程C++ yEnterCriticalSection函数代码示例写得很实用,希望能帮到您。

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

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

示例1: ySafeTrace

void  ySafeTrace(const char *file,u32 line,void *ptr){    u32 i;    YMEM_ENTRY *entry;        yEnterCriticalSection(&yMapCS);    for(i=0, entry=yMap; i< yMapUsed ; i++,entry++){        YASSERT(entry->state != YMEM_NOT_USED);        if(entry->ptr == ptr)            break;    }    if(i == yMapUsed){        dbglog("Update trace of unallocated pointer 0x%x at %s:%d/n/n",ptr,file,line);        ymemdump();        YASSERT(0);    }    if(entry->state == YMEM_FREED){        dbglog("Update trace of allready freed pointer (0x%x) at %s:%d/n",ptr,file,line);        dbglog("was allocated at %s:%d size =%d freed at %s:%d/n/n",               entry->malloc_file, entry->malloc_line, entry->malloc_size, entry->free_file,entry->free_line);        ymemdump();        YASSERT(0);    }    ymemdumpentry(entry,"trace");    entry->malloc_file = file;    entry->malloc_line = line;        yLeaveCriticalSection(&yMapCS);}
开发者ID:lucasroitman,项目名称:rosyocto3d,代码行数:28,


示例2: yyyReadIdle

//return 0 if a read is still pendingint yyyReadIdle(yInterfaceSt *iface,char *errmsg){    yEnterCriticalSection(&iface->yyyCS);    if(iface->devref==NULL){        yLeaveCriticalSection(&iface->yyyCS);        return YERR(YAPI_DEVICE_NOT_FOUND);    }    yLeaveCriticalSection(&iface->yyyCS);    return  YAPI_SUCCESS;}
开发者ID:octet8,项目名称:yoctolib_cpp,代码行数:11,


示例3: ySafeMemoryInit

void ySafeMemoryInit(u32 nbentry){    YASSERT(yMap==NULL && yMapSize==0);    yInitializeCriticalSection(&yMapCS);    yEnterCriticalSection(&yMapCS);    yMap = malloc(nbentry *sizeof(YMEM_ENTRY));    if(yMap){        yMapSize = nbentry;        memset(yMap,0,nbentry *sizeof(YMEM_ENTRY));        yMapUsed=0;    }        yLeaveCriticalSection(&yMapCS);}
开发者ID:lucasroitman,项目名称:rosyocto3d,代码行数:13,


示例4: yEnterCriticalSection

/** * Changes the primary unit for measuring humidity. That unit is a string. * If that strings starts with the letter 'g', the primary measured value is the absolute * humidity, in g/m3. Otherwise, the primary measured value will be the relative humidity * (RH), in per cents. * * Remember to call the saveToFlash() method of the module if the modification * must be kept. * * @param newval : a string corresponding to the primary unit for measuring humidity * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YHumidity::set_unit(const string& newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        rest_val = newval;        res = _setAttr("unit", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:30,


示例5: yEnterCriticalSection

/** * Changes the PWM duty cycle at device power on. Remember to call the matching * module saveToFlash() method, otherwise this call will have no effect. * * @param newval : a floating point number corresponding to the PWM duty cycle at device power on * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YPwmOutput::set_dutyCycleAtPowerOn(double newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%" FMTs64, (s64)floor(newval * 65536.0 + 0.5)); rest_val = string(buf);        res = _setAttr("dutyCycleAtPowerOn", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:25,


示例6: Handle_IOHIDDeviceIOHIDReportCallback

static void Handle_IOHIDDeviceIOHIDReportCallback(                void *          inContext,          // context from IOHIDDeviceRegisterInputReportCallback                IOReturn        inResult,           // completion result for the input report operation                void *          inSender,           // IOHIDDeviceRef of the device this report is from                IOHIDReportType inType,             // the report type                uint32_t        inReportID,         // the report ID                uint8_t *       inReport,           // pointer to the report data                CFIndex         InReportLength)     // the actual size of the input report{    yInterfaceSt *iface= (yInterfaceSt*) inContext;    yEnterCriticalSection(&iface->yyyCS);    yyPushNewPkt(iface,&iface->tmprxpkt);    memset(&iface->tmprxpkt,0xff,sizeof(USB_Packet));    yLeaveCriticalSection(&iface->yyyCS);}
开发者ID:octet8,项目名称:yoctolib_cpp,代码行数:15,


示例7: yEnterCriticalSection

/** * Changes the current expected position of the quadrature decoder. * Invoking this function implicitely activates the quadrature decoder. * * @param newval : a floating point number corresponding to the current expected position of the quadrature decoder * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YQuadratureDecoder::set_currentValue(double newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%" FMTs64, (s64)floor(newval * 65536.0 + 0.5)); rest_val = string(buf);        res = _setAttr("currentValue", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:25,


示例8: yEnterCriticalSection

/** * Changes the electric signal sampling method to use. * The HIGH_RATE method uses the highest sampling frequency, without any filtering. * The HIGH_RATE_FILTERED method adds a windowed 7-sample median filter. * The LOW_NOISE method uses a reduced acquisition frequency to reduce noise. * The LOW_NOISE_FILTERED method combines a reduced frequency with the median filter * to get measures as stable as possible when working on a noisy signal. * * @param newval : a value among Y_SIGNALSAMPLING_HIGH_RATE, Y_SIGNALSAMPLING_HIGH_RATE_FILTERED, * Y_SIGNALSAMPLING_LOW_NOISE, Y_SIGNALSAMPLING_LOW_NOISE_FILTERED and Y_SIGNALSAMPLING_HIGHEST_RATE * corresponding to the electric signal sampling method to use * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YGenericSensor::set_signalSampling(Y_SIGNALSAMPLING_enum newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);        res = _setAttr("signalSampling", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:yoctopuce,项目名称:yoctolib_cpp,代码行数:31,


示例9: yEnterCriticalSection

/** * Preset the state of the watchdog at device startup (A for the idle position, * B for the active position, UNCHANGED for no modification). Remember to call the matching module saveToFlash() * method, otherwise this call will have no effect. * * @param newval : a value among Y_STATEATPOWERON_UNCHANGED, Y_STATEATPOWERON_A and Y_STATEATPOWERON_B * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YWatchdog::set_stateAtPowerOn(Y_STATEATPOWERON_enum newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);        res = _setAttr("stateAtPowerOn", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:yoctopuce,项目名称:yoctolib_cpp,代码行数:26,


示例10: yEnterCriticalSection

/** * Changes the loop current at device start up. Remember to call the matching * module saveToFlash() method, otherwise this call has no effect. * * @param newval : a floating point number corresponding to the loop current at device start up * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YCurrentLoopOutput::set_currentAtStartUp(double newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%" FMTs64, (s64)floor(newval * 65536.0 + 0.5)); rest_val = string(buf);        res = _setAttr("currentAtStartUp", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:yoctopuce,项目名称:yoctolib_cpp,代码行数:25,


示例11: yEnterCriticalSection

/** * Changes the sensibility for the input (between 1 and 1000) for triggering user callbacks. * The sensibility is used to filter variations around a fixed value, but does not preclude the * transmission of events when the input value evolves constantly in the same direction. * Special case: when the value 1000 is used, the callback will only be thrown when the logical state * of the input switches from pressed to released and back. * Remember to call the saveToFlash() method of the module if the modification must be kept. * * @param newval : an integer corresponding to the sensibility for the input (between 1 and 1000) for * triggering user callbacks * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YAnButton::set_sensitivity(int newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);        res = _setAttr("sensitivity", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:30,


示例12: yEnterCriticalSection

/** * Changes the number of seconds between current time and UTC time (time zone). * The timezone is automatically rounded to the nearest multiple of 15 minutes. * * @param newval : an integer corresponding to the number of seconds between current time and UTC time (time zone) * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YRealTimeClock::set_utcOffset(int newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);        res = _setAttr("utcOffset", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:25,


示例13: yEnterCriticalSection

int YGps::set_command(const string& newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        rest_val = newval;        res = _setAttr("command", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:15,


示例14: yEnterCriticalSection

/** * Changes the number of child nodes expected in normal conditions. * If the value is zero, no check is performed. If it is non-zero, the number * child nodes is checked on startup and the status will change to error if * the count does not match. * * @param newval : an integer corresponding to the number of child nodes expected in normal conditions * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YDaisyChain::set_requiredChildCount(int newval){    string rest_val;    int res;    yEnterCriticalSection(&_this_cs);    try {        char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf);        res = _setAttr("requiredChildCount", rest_val);    } catch (std::exception) {         yLeaveCriticalSection(&_this_cs);         throw;    }    yLeaveCriticalSection(&_this_cs);    return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:27,


示例15: ySafeMemoryDump

void  ySafeMemoryDump(void *discard){    u32 i;    YMEM_ENTRY *entry;    yEnterCriticalSection(&yMapCS);    for(i=0, entry=yMap; i< yMapUsed ; i++,entry++){        if(entry->state == YMEM_MALLOCED && entry->ptr!=discard){            break;        }    }    if(i< yMapUsed){        ymemdump();    }    yLeaveCriticalSection(&yMapCS);}
开发者ID:lucasroitman,项目名称:rosyocto3d,代码行数:16,


示例16: yEnterCriticalSection

void *ySafeMalloc(const char *file,u32 line,u32 size){    u32 i;    YMEM_ENTRY *entry;    void *ptr;    yEnterCriticalSection(&yMapCS);    if(yMapUsed < yMapSize){        //use a new one        entry=yMap+yMapUsed;    }else{        // find a freed entry        for(i=0; i< yMapSize;i++){            if(yMap[i].state == YMEM_FREED)                break;                        }        if(i==yMapSize){            dbglog("No more entry available for ySafeMalloc/n/n");            ymemdump();            yLeaveCriticalSection(&yMapCS);            return NULL;        }        entry = yMap+i;    }    ptr=malloc(size);    if(!ptr){        dbglog("No more memory available (unable to allocate %d bytes)/n/n",size);        ymemdump();        yLeaveCriticalSection(&yMapCS);        return NULL;    }    memset(entry,0,sizeof(YMEM_ENTRY));    entry->state = YMEM_MALLOCED;    entry->malloc_file = file;    entry->malloc_line = line;    entry->ptr  = ptr;    entry->malloc_size = size;    if(yMapUsed < yMapSize)        yMapUsed++;    yLeaveCriticalSection(&yMapCS);    return ptr;    }
开发者ID:lucasroitman,项目名称:rosyocto3d,代码行数:45,


示例17: yyyPacketShutdown

void yyyPacketShutdown(yInterfaceSt  *iface){        yEnterCriticalSection(&iface->yyyCS);    if(iface->devref!=NULL){        IOHIDDeviceRegisterInputReportCallback( iface->devref,              // IOHIDDeviceRef for the HID device                                            (u8*) &iface->tmprxpkt,   // pointer to the report data (uint8_t's)                                            USB_PKT_SIZE,              // number of bytes in the report (CFIndex)                                            NULL,   // the callback routine                                            iface);                      // context passed to callback        IOHIDDeviceClose(iface->devref, kIOHIDOptionsTypeNone);        iface->devref=NULL;    }    yLeaveCriticalSection(&iface->yyyCS);    yDeleteCriticalSection(&iface->yyyCS);    yyyFreePktQueue(iface);}
开发者ID:octet8,项目名称:yoctolib_cpp,代码行数:18,



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


C++ yLeaveCriticalSection函数代码示例
C++ yAxis函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。