// manual iterations void RunExplicit() { Work(&List[0]); Work(&List[1]); Work(&List[2]); Work(&List[3]); Work(&List[4]); }
void solve(void) { Input(); int Ans = 0; for (int i = 1; i <= k; i++) Ans += Work(); printf("%d\n", (n - 1) * 2 - Ans + k); }
void WorkerThread::Run(Thread*, void*) { // set the thread-local-storage pointer to "this" LocalWorkerThread_ = this; //ThisThread_.reset( (const_cast<Worker *>(this)) ); // TODO: Fix this. // infinitely loop for(;;) { // go idle Idle(); // check to see if the pool wants to exit // - if so, break out of the loop if( Pool_->IsDone_ ) break; // loop and check to see if the pool thinks there is work to be done while(Pool_->CurrentCompletion_ != nullptr) { // do work Work(nullptr); // -> null is passed to designate that this is not a call from within a task // check to see if the pool wants to exit // - if so, break out of the loop if(Pool_->IsDone_) break; } } // release the thread-local-storage LocalWorkerThread_ = nullptr; //ThisThread_.release(); // TODO: Fix this. }
void do_resolve (std::vector <std::string> const& names, HandlerType const& handler, CompletionCounter) { check_precondition (! names.empty()); if (m_called_stop.load () == 0) { // TODO NIKB use emplace_back once we move to C++11 m_work.push_back(Work(names, handler)); m_journal.debug << "Queued new job with " << names.size() << " tasks. " << m_work.size() << " jobs outstanding."; if (m_work.size() == 1) { check_precondition (m_idle); m_journal.trace << "Waking up"; m_idle = false; m_io_service.post (m_strand.wrap (boost::bind ( &NameResolverImpl::do_work, this, CompletionCounter(this)))); } } }
void solve() { int K; scanf("%d%d%d", &n, &m, &K); if(n == 0 && m == 0 && K == 0) exit(0); Init(); Work(); }
int main(int argc, char **argv) { MPI_Init(&argc, &argv); double start_time, end_time; int i; // Init default values. Init_Default(); // Read arguments. Read_Options(argc, argv); // Init the matrix. Init_Matrix(); // Start timer. start_time = MPI_Wtime(); // Do guassian elimination. Work(); // Stop timer. end_time = MPI_Wtime(); if(PRINT == 1) { printf("===== AFTER GUASSIAN ELIMINATION ======\n"); Print_Matrix(); printf("=======================================\n\n"); } double time_taken = (end_time - start_time); printf("Execution time: %f\n", time_taken); }
int main(int argc, char *argv[]) { setIO("sample"); init();Work(); closeIO(); return EXIT_SUCCESS; }
int main() { while (scanf("%d",&N),N) { Work(); } return 0; }
bool CMusicLibraryJob::DoWork() { CMusicDatabase db; if (!db.Open()) return false; return Work(db); }
bool CVideoLibraryJob::DoWork() { CVideoDatabase db; if (!db.Open()) return false; return Work(db); }
void solve(void) { Input(); Cut(); Bfs(vs[1][0], vs[1][1]); Work(vs[0][0], vs[0][1]); int t1 = tim[vt[0]][vt[1]]; puts(t1?"YES":"NO"); }
main () { int step = 0; while ( 1 ) { if ( !init() ) break; step ++; printf ( "Case %d: %d\n" , step , Work () ); } }
int main() { StopWatch TotalTimer; TotalTimer.StartTimer(); int i = 0; Work(i); TotalTimer.StopTimer(); std::cout << "Time_Total: " << TotalTimer.GetElapsedSeconds() << std::flush << std::endl; }
inline void solve(void) { Input(); if (abs(a[n] - a[1]) > (Int64) d * (n - 1)) { puts("impossible"); return; } Int64 Ans = Work(); printf("%lld\n", Ans); }
// linked list iteration void RunThoughLinkedList() { node *pHead = Head; while(pHead != NULL) { Work(pHead); pHead = pHead->next; } }
int main() { if (!Init()) { return 0; } Work(); return 0; };
int main(int argc,char* argv[]) { printf("Input .."); Input(); printf("OK\n"); int i; // for(i=0;i!=N;++i) print(i); while(Work()); printf("Bye~\n"); return 0; }
void Work(int i) { if(i > 4) return; printf("S%d\n",i); cilk_spawn Work(i + 1); Delay(); printf("E %d\n",i); }
int main(int argc, char** argv) { #ifdef Debug freopen("1.in", "r", stdin); #endif for(long i = 0; i <= 9; i++) f[1][i] = 1; for(long i = 2; i <= 10; i++) for (long j = 0; j <= 9; j++) for (long k = 0; k <= 9; k++) if( abs(k - j) >= 2) f[i][j] += f[i - 1][k]; long l1, l2; scanf("%ld %ld", &l1, &l2); long A = Work(l2); long B = Work(l1 - 1); printf("%ld", abs( A - B )); return 0; }
static rc_t Run(const CmdLine* args) { rc_t rc = 0; Db db; SpotIterator it; assert(args); if (!SpotIteratorFileExists(args->file)) { rc = RC(rcExe, rcFile, rcOpening, rcFile, rcNotFound); PLOGERR(klogErr, (klogErr, rc, "Cannot find '$(path)'", "path=%s", args->file)); } else if (!SpotIteratorFileExists(args->table)) { rc = RC(rcExe, rcTable, rcOpening, rcTable, rcNotFound); PLOGERR(klogErr, (klogErr, rc, "Cannot find '$(path)'", "path=%s", args->table)); } { rc_t rc2 = DbInit(rc, args, &db); if (rc == 0) { rc = rc2; } } if (rc == 0) { rc = SpotIteratorInit(args->file, &db, &it); } if (rc == 0) { rc = Work(&db, &it); } if (rc == 0) { PLOGMSG(klogInfo, (klogInfo, "Success: redacted $(redacted) spots out of $(all)", "redacted=%d,all=%d", db.redactedSpots, db.nSpots)); } { rc_t rc2 = SpotIteratorDestroy(&it); if (rc == 0) { rc = rc2; } } { rc_t rc2 = DbDestroy(&db); if (rc == 0) { rc = rc2; } } return rc; }
int main() { bool bRet = Init(); if (!bRet) { return 0; } Work(); return 0; };
void Connection::ThreadStarter() { log_trace(); while (threadRunning_ && !CheckClose()) { Work(100); } log_debug("Connection thread exiting, fd=" << socket_.GetFileDescriptor()); // force the close to close since the thread may not be deleted right away socket_.Close(); threadRunning_ = false; }
void RunThoughLinkedList() { tbb::task_group g; node *pHead = Head; printf("Starting Linked List\n"); while(pHead != NULL) { g.run([=]{Work(pHead);}); pHead = pHead->next; } g.wait(); }
int main() { setIO("sample"); Prime(); for (scanf("%d",&ca);ca--;) { scanf("%d",&n); Work(); } closeIO(); return 0; }
GLDEF_C TInt E32Main() { CActiveScheduler* shed = new(ELeave) CActiveScheduler(); CActiveScheduler::Install(shed); __UHEAP_MARK; CTrapCleanup* cleanup = CTrapCleanup::New(); TRAPD(error,Work()); __ASSERT_ALWAYS(!error,SavePanic(error)); delete cleanup; __UHEAP_MARKEND; delete shed; return 0; }
void WorkerThread::YieldUntil( Completion * flag ) { // while the task that we're waiting on is not finished, do some work while( !flag->Done() ) Work( flag ); // if the flag is owned by the current root task, then since it's done the Pool should be notified // NOTE: Eventually other workers will see that there is no current main task to do, and after they are // done chewing through their own internal shit they will go idle waiting for the main thread to assign // them more work. if( Pool_->CurrentCompletion_ == flag ) Pool_->CurrentCompletion_ = nullptr; }
int main(int argc, char **argv) { struct DTDesc *TheDTDesc; if(Init(argc, argv, &TheDTDesc)) { Work(TheDTDesc); } Cleanup(TheDTDesc); return(0); }
int main (int argc, char **argv){ int myid; int i, j; int numWorkers; // assume number of body is multiple of number of workers MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &myid); MPI_Comm_size (MPI_COMM_WORLD, &numWorkers); // process 0 is coordinator process and also a worker process // work Work (myid, numWorkers); MPI_Finalize (); }
NS_IMETHODIMP FileSystemTaskBase::Run() { if (!NS_IsMainThread()) { // Run worker thread tasks Work(); // Dispatch itself to main thread NS_DispatchToMainThread(this); return NS_OK; } // Run main thread tasks HandleResult(); return NS_OK; }
main() { int part; order[0]=1; for (int i=1;i<5;i++) order[i]=order[i-1]*10; cin>>part; for (;part>0;part--) { init(); cin>>start>>goal; Work(); } }