bool yarn_exec_simple (yarn_executor_t executor, void* data, yarn_word_t thread_count, yarn_word_t ws_size, yarn_word_t index_size) { bool ret; bool del_on_exit = false; if (!g_is_init) { ret = yarn_init(); if (!ret) goto yarn_init_error; del_on_exit = true; } ret = init_dep(ws_size, index_size); if (!ret) goto dep_alloc_error; ret = yarn_epoch_reset(); if (!ret) goto epoch_reset_error; struct task_info info = {executor, data}; ret = yarn_tpool_exec(pool_worker_simple, (void*) &info, thread_count); if (!ret) goto exec_error; if (del_on_exit) yarn_destroy(); return true; exec_error: epoch_reset_error: dep_alloc_error: if(del_on_exit) yarn_destroy(); yarn_init_error: perror(__FUNCTION__); return false; }
/* * Generate dependencies for all files. */ int main(int argc, char **argv) { int len; const char *hpath; /* Initialize include hash tabel */ init_dep(); hpath = getenv("HPATH"); if (!hpath) { fputs("mkdep: HPATH not set in environment. " "Don't bypass the top level Makefile.\n", stderr); return 1; } add_path("."); /* for #include "..." */ while (++argv, --argc > 0) { if (strncmp(*argv, "-I", 2) == 0) { if (*((*argv)+2)) { add_path((*argv)+2); } else { ++argv; --argc; add_path(*argv); } } else if (strcmp(*argv, "--") == 0) { break; } } add_path(hpath); /* must be last entry, for config files */ while (--argc > 0) { const char * filename = *++argv; int i; g_filename = 0; len = strlen(filename); memcpy(depname, filename, len+1); if (len > 2 && filename[len-2] == '.') { if (filename[len-1] == 'c' || filename[len-1] == 'S') { depname[len-1] = 'o'; g_filename = filename; } } nb_include = 0; /* * print the base dependancy between the .o and .c file. */ if (depname[len-1] == 'h') { continue; } printf("%s: %s", depname,filename); /* * do basic dependancies on the C source file. */ handling_includes = 0; do_depend(filename); /* * recurse dependancies on the included files. * Warning, nb_include will grow over the loop. */ handling_includes = 1; for (i = 0;i < nb_include;i++) { filename = include_list[i]; /* * check the hash for existing dependencies. * !!! */ if (handling_includes) { current_include = add_inc((char *)filename); if (current_include->nb_includes >= 0) { int i; /* * do not load and parse the file, * dump the cache instead. */ for (i = 0;i < current_include->nb_includes;i++) add_local_include(current_include->includes[i]); continue; } } current_include = NULL; do_depend(filename); } /* * dump the dependancies found. */ for (i = 0;i < nb_include;i++) printf(" \\\n %s", include_list[i]); printf("\n"); } return 0; }