void for_chapter( void* udata, identifier chapter, git_time_t chapter_timestamp) { GDERP; SPAM("chapter %.*s %lu timestamp %d", g->location.l,g->location.s, chapter,chapter_timestamp - g->timestamp); g->any_chapter = true; //SPAM("chap %d:%d\n",chapter,chapter_timestamp); if(chapter_timestamp > g->max_timestamp) g->max_timestamp = chapter_timestamp; // this should be moved later... char srcname[0x100]; struct stat srcinfo; int src; bool setupsrc(void) { snprintf(srcname,0x100,"chapter%ld.hish",chapter); src = openat(g->srcloc, srcname, O_RDONLY, 0755); ensure_ge(src,0); // for adjusting dest timestamp ensure0(fstatat(g->srcloc,srcname,&srcinfo,0)); if(srcinfo.st_mtime > chapter_timestamp) { // git ruins file modification times... we probably cloned this, and lost // all timestamps. Just set the source file to have changed with the commit then. srcinfo.st_mtime = chapter_timestamp; return true; } return false; }
static bool start_worker(void) { if(numworkers >= MAXWORKERS) return false; // returns true if ACCEPTING is ready int pair[2]; ensure0(socketpair(AF_UNIX,SOCK_STREAM,0,pair)); worker_connected(pair[0]); getnowspec(&workers[numworkers-1].expiration); workers[numworkers-1].expiration.tv_sec += WORKER_LIFETIME; workers[numworkers-1].pid = launch_worker(pair[1]); close(pair[1]); }
void close_ptr(int* fd) { if(*fd == -1) return; ensure0(close(*fd)); *fd = -1; }
/*! \brief BaseThread destructor */ virtual ~BaseThread() { ensure0(!_hasTeam,"Destroying thread inside a team!"); ensure0((!_started || _id == 0),"Trying to destroy running thread"); }