⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 joinrace.c

📁 Newlib 嵌入式 C库 标准实现代码
💻 C
字号:
/* Test case by Permaine Cheung <pcheung@cygnus.com>.  */#include <errno.h>#include <pthread.h>#include <stdio.h>#include <stdlib.h>static void *sub1 (void *arg){  /* Nothing.  */  return NULL;}intmain (void){  int istatus;  int policy;  int cnt;  pthread_t thread1;  struct sched_param spresult1, sp1;  for (cnt = 0; cnt < 100; ++cnt)    {      printf ("Round %d\n", cnt);      pthread_create (&thread1, NULL, &sub1, NULL);      pthread_join (thread1, NULL);      istatus = pthread_getschedparam (thread1, &policy, &spresult1);      if (istatus != ESRCH)	{	  printf ("pthread_getschedparam returns: %d\n", istatus);	  return 1;	}      sp1.__sched_priority = 0;      istatus = pthread_setschedparam (thread1, SCHED_OTHER, &sp1);      if (istatus != ESRCH)	{	  printf ("pthread_setschedparam returns: %d\n", istatus);	  return 2;	}    }  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -