这篇教程C++ yLeaveCriticalSection函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中yLeaveCriticalSection函数的典型用法代码示例。如果您正苦于以下问题:C++ yLeaveCriticalSection函数的具体用法?C++ yLeaveCriticalSection怎么用?C++ yLeaveCriticalSection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了yLeaveCriticalSection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: 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,
示例2: 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,
示例3: 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,
示例4: yEnterCriticalSection/** * Changes the running state of the watchdog. * * @param newval : either Y_RUNNING_OFF or Y_RUNNING_ON, according to the running state of the watchdog * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YWatchdog::set_running(Y_RUNNING_enum newval){ string rest_val; int res; yEnterCriticalSection(&_this_cs); try { rest_val = (newval>0 ? "1" : "0"); res = _setAttr("running", rest_val); } catch (std::exception) { yLeaveCriticalSection(&_this_cs); throw; } yLeaveCriticalSection(&_this_cs); return res;}
开发者ID:yoctopuce,项目名称:yoctolib_cpp,代码行数:24,
示例5: 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,
示例6: 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,
示例7: 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,
示例8: 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,
示例9: 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,
示例10: yEnterCriticalSection/** * Changes the representation system used for positioning data. * * @param newval : a value among Y_COORDSYSTEM_GPS_DMS, Y_COORDSYSTEM_GPS_DM and Y_COORDSYSTEM_GPS_D * corresponding to the representation system used for positioning data * * @return YAPI_SUCCESS if the call succeeds. * * On failure, throws an exception or returns a negative error code. */int YGps::set_coordSystem(Y_COORDSYSTEM_enum newval){ string rest_val; int res; yEnterCriticalSection(&_this_cs); try { char buf[32]; sprintf(buf, "%d", newval); rest_val = string(buf); res = _setAttr("coordSystem", rest_val); } catch (std::exception) { yLeaveCriticalSection(&_this_cs); throw; } yLeaveCriticalSection(&_this_cs); return res;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:25,
示例11: 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,
示例12: ySafeTracevoid 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,
示例13: yEnterCriticalSectionvoid *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,
示例14: yyyWriteint yyyWrite(yInterfaceSt *iface,USB_Packet *pkt,char *errmsg){ IOReturn res; yEnterCriticalSection(&iface->yyyCS); if(iface->devref==NULL){ yLeaveCriticalSection(&iface->yyyCS); return YERR(YAPI_DEVICE_NOT_FOUND); } res = IOHIDDeviceSetReport(iface->devref, kIOHIDReportTypeOutput, 0, /* Report ID*/ (u8*)pkt, sizeof(USB_Packet)); yLeaveCriticalSection(&iface->yyyCS); if (res != kIOReturnSuccess) { dbglog("IOHIDDeviceSetReport failed with 0x%x/n", res); return YERR(YAPI_IO_ERROR); } return 0;}
开发者ID:octet8,项目名称:yoctolib_cpp,代码行数:19,
示例15: yEnterCriticalSection/** * Retrieves a ground speed sensor for a given identifier. * The identifier can be specified using several formats: * <ul> * <li>FunctionLogicalName</li> * <li>ModuleSerialNumber.FunctionIdentifier</li> * <li>ModuleSerialNumber.FunctionLogicalName</li> * <li>ModuleLogicalName.FunctionIdentifier</li> * <li>ModuleLogicalName.FunctionLogicalName</li> * </ul> * * This function does not require that the ground speed sensor is online at the time * it is invoked. The returned object is nevertheless valid. * Use the method YGroundSpeed.isOnline() to test if the ground speed sensor is * indeed online at a given time. In case of ambiguity when looking for * a ground speed sensor by logical name, no error is notified: the first instance * found is returned. The search is performed first by hardware name, * then by logical name. * * If a call to this object's is_online() method returns FALSE although * you are certain that the matching device is plugged, make sure that you did * call registerHub() at application initialization time. * * @param func : a string that uniquely characterizes the ground speed sensor * * @return a YGroundSpeed object allowing you to drive the ground speed sensor. */YGroundSpeed* YGroundSpeed::FindGroundSpeed(string func){ YGroundSpeed* obj = NULL; int taken = 0; if (YAPI::_apiInitialized) { yEnterCriticalSection(&YAPI::_global_cs); taken = 1; }try { obj = (YGroundSpeed*) YFunction::_FindFromCache("GroundSpeed", func); if (obj == NULL) { obj = new YGroundSpeed(func); YFunction::_AddToCache("GroundSpeed", func, obj); } } catch (std::exception) { if (taken) yLeaveCriticalSection(&YAPI::_global_cs); throw; } if (taken) yLeaveCriticalSection(&YAPI::_global_cs); return obj;}
开发者ID:LudovicRousseau,项目名称:yoctolib_cpp,代码行数:47,
注:本文中的yLeaveCriticalSection函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ yaffs_close函数代码示例 C++ yEnterCriticalSection函数代码示例 |