/*override*/void process( job& j, void* cookie, size_type index ) { MyTeam& t = *static_cast<MyTeam*>(cookie); ASSERT( t.self_ptr==&t, "trashed cookie" ); ASSERT( index<t.max_thread, NULL ); ASSERT( !t.info[index].ran, "duplicate index?" ); t.info[index].job = &j; t.info[index].ran = true; do_process(j); if( index==1 && nesting.level<nesting.limit ) { DoOneConnection<MyFactory,MyClient> doc(MaxThread,Nesting(nesting.level+1,nesting.limit),0,false); doc(0); } #if _WIN32||_WIN64 // test activate/deactivate if( t.n_thread>1 && t.n_thread%2==0 ) { if( nesting.level==0 ) { if( index&1 ) { size_type target = index-1; ASSERT( target<t.max_thread, NULL ); // wait until t.info[target].job is defined tbb::internal::spin_wait_until_eq( t.info[target].ran, true ); server->try_increase_load( 1, true ); server->reactivate( t.info[target].job ); } else { server->deactivate( &j ); } } } #endif /* _WIN32||_WIN64 */ ++t.barrier; }