示例#1
0
int		sudoki_bi()
{
  char		***tab;
  t_list	*list;
  t_present	*present;
  int		i;

  if ((tab = get_all_tab()) == NULL)
    return (-1);
  i = -1;
  while (++i < my_tablen(tab))
    {
      if ((present = get_present(tab[i])) == NULL ||
	  (list = get_list(tab[i])) == NULL)
	return (-1);
      filler(tab[i], list, present);
      if (check_valid(tab[i]) == 1)
        error_aff_tab();
      else
        aff_table(tab[i]);
      if (i < (my_tablen(tab) - 1))
        write(1, "####################\n", 21);
      free_function_bis(list, present);
    }
  free_function(tab);
  return (0);
}
示例#2
0
void force_one_affinity(int a, int sz,int verbose, char *name) {
  if (a >= 0) {
    cpu_set_t mask;
    int r ;
    CPU_ZERO(&mask) ;
    CPU_SET(a,&mask) ;
    do {
      r = pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) ;
      if (r != 0) {
        if (verbose)
          fprintf(stderr,"%s: force %i failed\n",name,a) ;
        int nwarm = get_present() ;
        if (verbose > 1)
          fprintf(stderr,"%s: present=%i\n",name,nwarm) ;
        if (nwarm < 0) nwarm = sz+1 ;
        warm_up(nwarm,sec/100) ;
      }
    } while (r != 0) ;
  }
}