void get_start() { int h,num=sizeof(hosts)/sizeof(hosts_t); //pthread_mutex_setprioceiling(gwmut,0,&h); for(h=0;h<num;h++){ GetworkThread *gwt = new GetworkThread(); hosts[h].gwt=gwt; gwt->host=h; gwt->Start();} }
void get_start() { int h; FILE* fp=fopen(".host.cnf","r"); static char buf[MAXHOSTS][2][256]; char line[256]; if(fp!=NULL){ for(h=0;h<MAXHOSTS && fgets(line,256,fp)!=NULL;h++){ if(sscanf(line,"%s %s",buf[h][0]+6,buf[h][1]+0)!=2){ printf("ERROR: wrong format in line %d of .host.cnf, fatal\n%s\n",h+1,line); exit(-1);} strncpy(buf[h][0],"Basic ",6); hosts[h].aut=buf[h][0]; hosts[h].url=buf[h][1];} fclose(fp);} for(h=0;h<MAXHOSTS;h++){ if(hosts[h].url==NULL){ continue;} GetworkThread *gwt = new GetworkThread(); hosts[h].gwt=gwt; gwt->host=h; gwt->Start();} }