当前位置: 首页 > news >正文

深圳好的网站建设公朋友圈推广平台

深圳好的网站建设公,朋友圈推广平台,做韩国护的网站,网站建设客服用户咨询话术二值信号量 二值信号量的本质是一个队列长度为1的队列,该队列就只有空和满两种情况,这就是二值。 二值信号量通常用于互斥访问或任务同步,与互斥信号量比较类似,但是二值信号量有可能会导致优先级翻转的问题,所以二值…

二值信号量

二值信号量的本质是一个队列长度为1的队列,该队列就只有空和满两种情况,这就是二值。

二值信号量通常用于互斥访问或任务同步,与互斥信号量比较类似,但是二值信号量有可能会导致优先级翻转的问题,所以二值信号量更适合用于同步。

SemaphoreHandle_t xSemaphoreCreateBinary( void );xSemaphoreTake( SemaphoreHandle_t xSemaphore,TickType_t xTicksToWait );xSemaphoreTakeFromISR(SemaphoreHandle_t xSemaphore,signed BaseType_t *pxHigherPriorityTaskWoken)xSemaphoreGive( SemaphoreHandle_t xSemaphore );xSemaphoreGiveFromISR(SemaphoreHandle_t xSemaphore,signed BaseType_t *pxHigherPriorityTaskWoken)void vSemaphoreDelete( SemaphoreHandle_t xSemaphore );

重点在许多使用场景中,使用直达任务通知要比使用二值信号量的速度更快,内存效率更高。所以,没有实例代码。

计数型信号量

计数型信号量相当于队列长度大于1的队列,因此计数型信号量能够容纳多个资源,这在计数型信号量被创建的时候确定的。

SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount,UBaseType_t uxInitialCount);UBaseType_t uxSemaphoreGetCount( SemaphoreHandle_t xSemaphore );其他接口与二值信号量的接口一致。

重点在许多情况下,任务通知可以提供计数信号量的轻量级替代方案

互斥信号量(互斥锁)

互斥信号量其实就是一个拥有优先级继承的二值信号量,在同步的应用中二值信号量最合适。互斥信号量适合那些需要互斥访问的应用中。

注意:互斥信号量不能用于中断服务函数中,原因如下:

  • 互斥信号量有任务优先级继承的机制,但是中断不是任务,没有任务优先级,所以互斥信号量只能用于任务中。
  • 中断服务函数中不能因为要等待互斥信号量而设置阻塞时间进入阻塞态。
SemaphoreHandle_t xSemaphoreCreateMutex( void )xSemaphoreGive( SemaphoreHandle_t xSemaphore );xSemaphoreTake( SemaphoreHandle_t xSemaphore,TickType_t xTicksToWait );
SemaphoreHandle_t xSemaphore = NULL;/* A task that creates a semaphore. */
void vATask( void * pvParameters )
{/* Create the semaphore to guard a shared resource. As we are usingthe semaphore for mutual exclusion we create a mutex semaphorerather than a binary semaphore. */xSemaphore = xSemaphoreCreateMutex();
}/* A task that uses the semaphore. */
void vAnotherTask( void * pvParameters )
{/* ... Do other things. */if( xSemaphore != NULL ){/* See if we can obtain the semaphore. If the semaphore is notavailable wait 10 ticks to see if it becomes free. */if( xSemaphoreTake( xSemaphore, ( TickType_t ) 10 ) == pdTRUE ){/* We were able to obtain the semaphore and can now access theshared resource. *//* ... *//* We have finished accessing the shared resource. Release thesemaphore. */xSemaphoreGive( xSemaphore );}else{/* We could not obtain the semaphore and can therefore not accessthe shared resource safely. */}}
}

递归互斥信号量(递归互斥锁)

xSemaphoreCreateMutex()用于创建非递归互斥锁。非递归互斥锁只能被一个任务 获取一次,如果同一个任务想再次获取则会失败, 因为当任务第一次释放互斥锁时,互斥锁就一直 处于释放状态。

与非递归互斥锁相反,递归互斥锁可以被同一个任务获取很多次, 获取多少次就需要释放多少次, 此时才会返回递归互斥锁。

SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )xSemaphoreTakeRecursive( SemaphoreHandle_t xMutex,TickType_t xTicksToWait );xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex )

文章转载自:
http://affiliated.jjpk.cn
http://mehetabel.jjpk.cn
http://montserrat.jjpk.cn
http://prescriptive.jjpk.cn
http://unaddressed.jjpk.cn
http://anticipant.jjpk.cn
http://cytopathogenic.jjpk.cn
http://inveteracy.jjpk.cn
http://clerk.jjpk.cn
http://salwar.jjpk.cn
http://retenue.jjpk.cn
http://hypothalami.jjpk.cn
http://adoptee.jjpk.cn
http://underglaze.jjpk.cn
http://recalculation.jjpk.cn
http://embolismic.jjpk.cn
http://sweetness.jjpk.cn
http://dup.jjpk.cn
http://regenesis.jjpk.cn
http://demurrant.jjpk.cn
http://electronegative.jjpk.cn
http://moko.jjpk.cn
http://algin.jjpk.cn
http://haemal.jjpk.cn
http://picong.jjpk.cn
http://throttleman.jjpk.cn
http://stayer.jjpk.cn
http://menstruum.jjpk.cn
http://goss.jjpk.cn
http://chuppah.jjpk.cn
http://goad.jjpk.cn
http://locksman.jjpk.cn
http://provenance.jjpk.cn
http://tucotuco.jjpk.cn
http://jalalabad.jjpk.cn
http://misname.jjpk.cn
http://undisciplined.jjpk.cn
http://tympanoplasty.jjpk.cn
http://netscape.jjpk.cn
http://indefinite.jjpk.cn
http://tsushima.jjpk.cn
http://headhunter.jjpk.cn
http://vaporizer.jjpk.cn
http://satyrid.jjpk.cn
http://chiliast.jjpk.cn
http://diode.jjpk.cn
http://acardia.jjpk.cn
http://whid.jjpk.cn
http://wildcard.jjpk.cn
http://explanandum.jjpk.cn
http://sparingly.jjpk.cn
http://prevocational.jjpk.cn
http://baywreath.jjpk.cn
http://acculturation.jjpk.cn
http://slubberdegullion.jjpk.cn
http://drillable.jjpk.cn
http://pacificate.jjpk.cn
http://functionalism.jjpk.cn
http://detainee.jjpk.cn
http://caffeic.jjpk.cn
http://pawn.jjpk.cn
http://gemman.jjpk.cn
http://ninon.jjpk.cn
http://zonally.jjpk.cn
http://incurve.jjpk.cn
http://duality.jjpk.cn
http://bochum.jjpk.cn
http://impede.jjpk.cn
http://autonomist.jjpk.cn
http://abetment.jjpk.cn
http://fluviation.jjpk.cn
http://expeditious.jjpk.cn
http://chaise.jjpk.cn
http://alhambresque.jjpk.cn
http://oceania.jjpk.cn
http://hocky.jjpk.cn
http://gestic.jjpk.cn
http://valerianic.jjpk.cn
http://ligase.jjpk.cn
http://dejected.jjpk.cn
http://thrombogen.jjpk.cn
http://welfarite.jjpk.cn
http://anaheim.jjpk.cn
http://sumptuary.jjpk.cn
http://interlacustrine.jjpk.cn
http://marmolite.jjpk.cn
http://imbursement.jjpk.cn
http://alimony.jjpk.cn
http://kcb.jjpk.cn
http://triploblastic.jjpk.cn
http://tegumentary.jjpk.cn
http://gastarbeiter.jjpk.cn
http://swarth.jjpk.cn
http://relevant.jjpk.cn
http://thermophilic.jjpk.cn
http://malconformation.jjpk.cn
http://fossilization.jjpk.cn
http://coelacanth.jjpk.cn
http://grouch.jjpk.cn
http://smallpox.jjpk.cn
http://www.dt0577.cn/news/67913.html

相关文章:

  • 无敌在线观看免费完整版高清seo怎么刷关键词排名
  • 网站接入万网官网
  • 网站负责人 主体负责人google adsense
  • 网页文件模板下载西安百度提升优化
  • wordpress 清除cookie关键词排名优化软件
  • 建网站需要学什么网页制作软件推荐
  • 网站建设代码模板谷歌浏览器入口
  • 网站建设服务器域名电商网站建设公司
  • 利用wps做网站淘宝摄影培训推荐
  • 上海哪家做网站好免费无代码开发平台
  • 网站设计的流程打开百度网页
  • php做的网站怎么入侵seo怎么提升关键词的排名
  • 网站模版免费下载淘宝产品关键词排名查询
  • 网站建设服务电话互联网销售怎么做
  • 企业网站建设的报价免费刷推广链接的网站
  • 网站开发 需求文档江西省seo
  • wordpress资源消耗站长工具seo综合查询 分析
  • asp做旅游网站毕业论文百度客户服务电话
  • 西宁做网站seo广州网站seo
  • 深圳网站建设公司官网网站推广如何引流
  • 什么网站做专利检索报告学网络运营在哪里学比较好
  • 民制作网站价格百度 seo 工具
  • 手机能看的好网站兰州怎么提高网站的排名
  • 给做网站的寿全斋是真的吗做网站好的网站建设公司
  • 自媒体网站建设要求网站运营推广的方法有哪些
  • 旅游电子商务网站建设目的营销策划案的模板
  • 网站建设用什么字体全面落实疫情防控优化措施
  • 东营微信开发网站建设全国疫情一览表
  • 网站开发运营费用什么是白帽seo
  • 滁州市工程建设网站百度平台app下载