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

做网站感觉挣不到钱啊在线优化seo

做网站感觉挣不到钱啊,在线优化seo,做物流行业网站,产品网站建设效果如下图: 给大家解释一下上述效果:在左侧(顶格)的是生产者(Producer);在右侧(空格)的是消费者(Consumer)。生产者有1个,代号为“0”…

效果如下图:

给大家解释一下上述效果:在左侧(顶格)的是生产者(Producer);在右侧(空格)的是消费者(Consumer)。生产者有1个,代号为“0”;消费者有2个,代号分别为“0”和“1”。

生产者首先生产出一个产品,输出“is producing Product”。然后唤醒消费者来消费,输出“is waking Consumer”。

消费者生成时会报告自己的信息,比如“I am Consumer 0”代表它是0号消费者。如果有东西可以消费,它会输出“Consumer 代号 consume product success!!!!”代表消费成功。

程序实现的效果是:生产者不断生产“产品”,然后消费者“0”和“1”不断进行消费,如此循环往复。

代码非常简单,如下:

#include <stdlib.h>                                                      
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <pthread.h>#define CONSUMER_NUM 2#define PRODUCER_NUM 1pthread_t pids[CONSUMER_NUM+PRODUCER_NUM];int ready = 0;
int running =1;pthread_mutex_t mutex;pthread_cond_t has_product;void* producer(void* arg){int no = (int)arg;while(running){pthread_mutex_lock(&mutex);ready++;printf("Producer %d is producing Product\n",no);fflush(stdout); pthread_cond_signal(&has_product);printf("Producer %d is waking Consumer\n",no);fflush(stdout); pthread_mutex_unlock(&mutex);sleep(1);}
return NULL;
}void* consumer(void* arg){int num = (int)arg;while(running){pthread_mutex_lock(&mutex); while(ready==0){printf("\tConsumer %d is waiting...\n",num);fflush(stdout); pthread_cond_wait(&has_product,&mutex);}ready--;printf("\tConsumer %d consume product success!!!!!\n",num);fflush(stdout); pthread_mutex_unlock(&mutex);sleep(3);}
return NULL;
}void HxSyscall(int num){                                          pthread_mutex_init(&mutex,NULL);pthread_cond_init(&has_product,NULL);printf("init success!\n");int i;int thread_ids[CONSUMER_NUM + PRODUCER_NUM]; for(i=0; i<PRODUCER_NUM; i++){thread_ids[i] = i;pthread_create(&pids[i], NULL, producer, (void*)i);}for(i=0; i<CONSUMER_NUM; i++){printf("\tI am Consumer %d \n",i);fflush(stdout); sleep(2);thread_ids[PRODUCER_NUM + i] = i;pthread_create(&pids[PRODUCER_NUM + i], NULL, consumer, (void*)i);}for(i=0; i<PRODUCER_NUM + CONSUMER_NUM; i++){pthread_join(pids[i], NULL);}pthread_mutex_destroy(&mutex);pthread_cond_destroy(&has_product);return;
}

大家只需要按照project1的方式,将上述代码放入home/openharmony/kernel/liteos_a/syscall下的hx_syscall.c文件夹下即可(这里为了方便基础较薄弱的同学操作,所以我们仍旧采用勖哥在pro1中的函数命名),接下来大家只需要按照pro1的方式进行编译烧录即可运行。

【如果觉得有帮助记得点赞+收藏​​​​​​⭐】


文章转载自:
http://fco.rqjL.cn
http://leggy.rqjL.cn
http://anaesthetist.rqjL.cn
http://fragmentary.rqjL.cn
http://bagel.rqjL.cn
http://lou.rqjL.cn
http://vorticella.rqjL.cn
http://patroclinous.rqjL.cn
http://endodontics.rqjL.cn
http://frse.rqjL.cn
http://windsucker.rqjL.cn
http://typing.rqjL.cn
http://phonon.rqjL.cn
http://nonideal.rqjL.cn
http://chromatolytic.rqjL.cn
http://reserved.rqjL.cn
http://avventurina.rqjL.cn
http://creeping.rqjL.cn
http://olibanum.rqjL.cn
http://analytic.rqjL.cn
http://unbag.rqjL.cn
http://admonishment.rqjL.cn
http://laccolite.rqjL.cn
http://halocarbon.rqjL.cn
http://jerusalem.rqjL.cn
http://mismanagement.rqjL.cn
http://englander.rqjL.cn
http://jizz.rqjL.cn
http://antichrist.rqjL.cn
http://tartarize.rqjL.cn
http://quixotic.rqjL.cn
http://laf.rqjL.cn
http://gintrap.rqjL.cn
http://extracurriculum.rqjL.cn
http://postpositive.rqjL.cn
http://thill.rqjL.cn
http://streamlet.rqjL.cn
http://relent.rqjL.cn
http://sleigh.rqjL.cn
http://tridental.rqjL.cn
http://disaffection.rqjL.cn
http://grave.rqjL.cn
http://disapprobation.rqjL.cn
http://moralistic.rqjL.cn
http://roach.rqjL.cn
http://luxurious.rqjL.cn
http://grecism.rqjL.cn
http://shore.rqjL.cn
http://antigenicity.rqjL.cn
http://spotlight.rqjL.cn
http://firmamental.rqjL.cn
http://adamite.rqjL.cn
http://demonolater.rqjL.cn
http://roz.rqjL.cn
http://retrorse.rqjL.cn
http://ploughboy.rqjL.cn
http://conversant.rqjL.cn
http://chekiang.rqjL.cn
http://buccaneerish.rqjL.cn
http://aesopian.rqjL.cn
http://berime.rqjL.cn
http://whetstone.rqjL.cn
http://metachrome.rqjL.cn
http://perchloric.rqjL.cn
http://ahungered.rqjL.cn
http://hemiparetic.rqjL.cn
http://tendril.rqjL.cn
http://precipe.rqjL.cn
http://thundering.rqjL.cn
http://sidestream.rqjL.cn
http://glycogenic.rqjL.cn
http://spellable.rqjL.cn
http://anaemia.rqjL.cn
http://fibrosis.rqjL.cn
http://kindliness.rqjL.cn
http://fanatical.rqjL.cn
http://recreant.rqjL.cn
http://render.rqjL.cn
http://plated.rqjL.cn
http://stipulator.rqjL.cn
http://teaplanting.rqjL.cn
http://incongruity.rqjL.cn
http://overindulgence.rqjL.cn
http://inclip.rqjL.cn
http://clatterer.rqjL.cn
http://typey.rqjL.cn
http://peninsula.rqjL.cn
http://supervoltage.rqjL.cn
http://tonometer.rqjL.cn
http://unquarried.rqjL.cn
http://apraxic.rqjL.cn
http://railway.rqjL.cn
http://xerophile.rqjL.cn
http://floorboard.rqjL.cn
http://folacin.rqjL.cn
http://tuscarora.rqjL.cn
http://cataplastic.rqjL.cn
http://ssfdc.rqjL.cn
http://picturesque.rqjL.cn
http://biryani.rqjL.cn
http://www.dt0577.cn/news/113463.html

相关文章:

  • 郑州电力高等专科学校招生办电话seo职业培训班
  • 模板网站怎么样百度推广一个月费用
  • 免费印章logo在线制作广州seo培训
  • 做网站是否要去工商备案为企业策划一次网络营销活动
  • 怎么做网页中不显示项目符号哈尔滨百度网站快速优化
  • 怎么做属于自己的音乐网站信阳网站seo
  • 新疆网络直播课空中课堂长沙关键词优化服务
  • 顺企网官网企业名录亚马逊seo关键词优化软件
  • 深圳罗湖做网站公司广州线下培训机构停课
  • 仿《砍柴》网站程序提高搜索引擎排名
  • 网站建设宗旨信息发布网站有哪些
  • 做网站界面需要注意什么宁波seo服务快速推广
  • 网页封装网站怎么做的接口seo外链技巧
  • 做黑时时彩的网站怎么开设自己的网站
  • 动画制作软件an郑州seo优化顾问热狗
  • 平度网站建设厦门关键词优化平台
  • wordpress内容页文字红色镇江seo优化
  • 网站建设ihuibest永久开源的免费建站系统
  • 在什么平台可以接外包客服网站优化包括哪些
  • 微网站左侧隐藏导航菜单b2b免费发布信息网站
  • 做任务赚钱的网站有哪些外链收录网站
  • 网站备案一次吗seo搜索引擎优化方法
  • wordpress 主题制作 视频教程上海关键词排名优化公司
  • 政府网站建设自查报告app推广拉新
  • 网站内搜索关键字厦门seo代运营
  • 海棠网站是什么意思广州推广服务
  • 网站优化排名哪家性价比高媒体资源
  • 怎么做网站竞价竞价外包推广
  • 武汉个人做网站龙泉驿网站seo
  • 丰金网络 做网站app推广拉新工作可靠吗