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

网站被k换域名 老域名能不能跳转WordPress怎么文章分类

网站被k换域名 老域名能不能跳转,WordPress怎么文章分类,外贸原单童装哪个网站做,大连建设网水电费查询官网这个例程为使用多线程配合互斥量进行点乘计算#xff0c;相关的数据通过全局变量的形式存在#xff0c;因此可以被各个线程访问#xff1b;每个线程会在相关数据的不同区域上进行处理#xff0c;主线程等待子线程完成操作后#xff0c;将最后的结果打印出来。 代码如下 #…        这个例程为使用多线程配合互斥量进行点乘计算相关的数据通过全局变量的形式存在因此可以被各个线程访问每个线程会在相关数据的不同区域上进行处理主线程等待子线程完成操作后将最后的结果打印出来。 代码如下 #include pthread.h #include stdio.h #include stdlib.h/* The following structure contains the necessary information* to allow the function dotprod to access its input data and* place its output into the structure.*/typedef struct {double *a;double *b;double sum;int veclen; } DOTDATA;/* Define globally accessible variables and a mutex */#define NUMTHRDS 4 #define VECLEN 100DOTDATA dotstr; pthread_t callThd[NUMTHRDS]; pthread_mutex_t mutexsum;/* The function dotprod is activated when the thread is created.* All input to this routine is obtained from a structure* of type DOTDATA and all output from this function is written into* this structure. The benefit of this approach is apparent for the* multi-threaded program: when a thread is created we pass a single* argument to the activated function - typically this argument* is a thread number. All the other information required by the* function is accessed from the globally accessible structure.*/void *dotprod(void *arg) {/* Define and use local variables for convenience */int i, start, end, len;long offset;double mysum, *x, *y;offset (long)arg;len dotstr.veclen;start offset * len;end start len;x dotstr.a;y dotstr.b;/*Perform the dot product and assign resultto the appropriate variable in the structure.*/mysum 0;for (i start; i end ; i) {mysum (x[i] * y[i]);}/*Lock a mutex prior to updating the value in the sharedstructure, and unlock it upon updating.*/pthread_mutex_lock(mutexsum);dotstr.sum mysum;pthread_mutex_unlock(mutexsum);pthread_exit((void*) 0); }/* The main program creates threads which do all the work and then* print out result upon completion. Before creating the threads,* the input data is created. Since all threads update a shared structure,* we need a mutex for mutual exclusion. The main thread needs to wait for* all threads to complete, it waits for each one of the threads. We specify* a thread attribute value that allow the main thread to join with the* threads it creates. Note also that we free up handles when they are* no longer needed.*/int main (int argc, char *argv[]) {long i;double *a, *b;void *status;pthread_attr_t attr;/* Assign storage and initialize values */a (double*) malloc (NUMTHRDS * VECLEN * sizeof(double));b (double*) malloc (NUMTHRDS * VECLEN * sizeof(double));for (i 0; i VECLEN * NUMTHRDS; i) {a[i] 1.0;b[i] a[i];}dotstr.veclen VECLEN;dotstr.a a;dotstr.b b;dotstr.sum 0;pthread_mutex_init(mutexsum, NULL);/* Create threads to perform the dot product */pthread_attr_init(attr);pthread_attr_setdetachstate(attr, PTHREAD_CREATE_JOINABLE);for(i 0; i NUMTHRDS; i) {/* Each thread works on a different set of data. The offset is specified* by i. The size of the data for each thread is indicated by VECLEN.*/pthread_create(callThd[i], attr, dotprod, (void *)i);}pthread_attr_destroy(attr);/* Wait on the other threads */for(i 0; i NUMTHRDS; i) {pthread_join(callThd[i], status);}/* After joining, print out the results and cleanup */printf(Sum %f\n, dotstr.sum);free(a);free(b);pthread_mutex_destroy(mutexsum);pthread_exit(NULL); }
http://www.hkea.cn/news/14279759/

相关文章:

  • 中国有多少网站有多少域名做公司网站是永久性的吗
  • 做网站有年费吗安卓开发软件安装教程
  • 可以找厂家的网站青岛网站建设网站设计
  • wordpress怎么修改域名宁波优化网站排名软件
  • 网站上传到万网主机邢台医院网站建设
  • 专业外贸网站建设公司西三旗网站建设
  • 东莞建设网站流程wordpress+电脑微信登陆
  • 公司网站开发毕业设计一级a做爰片免费网站短视频
  • wordpress 网站白屏注册域名
  • 做笔记的网站汕头网站制作多少钱
  • 建设网站时seo标题网站开发类书籍
  • 建设一个网站可以采用哪几种方案网站关联词搜索怎么做
  • 网站建设与维护 许宝良 课件流量比对网站
  • 在哪个网站可以找做海报的模板买网站自己做
  • 御花园网站建设公司枣庄手机网站制作
  • 关于酒店网站建设的摘要托福培训一对一
  • 网站内如何@企业如何 建设好自己的网站
  • 网站导出链接查询柳州市住房建设保障网
  • 凡客做网站大连网站设计收费标准
  • 营销型网站页面摸板wordpress jigoshop
  • 海淀网站建设枣庄百度竞价网站
  • 免费建站软件哪个好定制企业网站
  • 片头网站2345网址导航手机版下载
  • 海外网站哪个最好好用的app推荐大全
  • 有服务器怎么做网站教程腾讯云10g数字盘做网站够么
  • 建设信用卡在网站挂失块吗破解网站后台密码有人做吗
  • 自己做网站如何赚钱微网站备案
  • 网站上的验证码怎么做的设计公司网站要包含什么信息
  • 付费阅读小说网站开发建设源码图形化app开发工具
  • 网站做301还是302网络组建与维护心得体会