/*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; }
/*override*/void process( job& j ) { do_process(j); //wait until the gate is open. while( gate==0 ) Harness::Sleep(1); __TBB_ASSERT( nesting.limit<=2, NULL ); if( nesting.level>=nesting.limit ) return; size_type max_outstanding_connections = max_job_count(); // if nesting.level==0 if( nesting.level==1 ) max_outstanding_connections *= (1+max_outstanding_connections); if( default_concurrency()<=max_outstanding_connections+2 ) // i.e., if it is not guaranteed that at least two connections may be made without depleting the_balance return; // at this point, ( nesting.level<nesting.limit ) && ( my_server->default_concurrency()-max_outstanding_connections>2 ) for( ;; ) { while( n_available_hw_threads<=1 ) Harness::Sleep(1); int n = --n_available_hw_threads; if( n>0 ) break; // else I lost ++n_available_hw_threads; } DoOneConnection<MyFactory,MyClient> doc(max_job_count(),Nesting(nesting.level+1,nesting.limit),0,false); doc(0); ++n_available_hw_threads; }
DISPLAY_INT HTMLList::GetParagraphSpace(void) { if (Nesting() == 0) { return (HTMLParagraph::GetParagraphSpace()); } return (0); }
bool XmlParser::Tag(const String& tag) { if(IsTag() && tagtext == tag) { LLOG("Tag " << tagtext); stack.Add(Nesting(tagtext, npreserve)); attr = nattr; attr1 = nattr1; attrval1 = nattrval1; Next(); return true; } return false; }
String XmlParser::ReadTag(bool next) { if(type != XML_TAG) throw XmlError("Expected tag"); LLOG("ReadTag " << text); String h = tagtext; if(next) { stack.Add(Nesting(h, npreserve)); attr = nattr; attr1 = nattr1; attrval1 = nattrval1; Next(); } return h; }
void Initialize() { MyClient* client = new MyClient; client->initialize( 1, Nesting(), ClientStackSize[0] ); MyFactory factory; memset( &factory, 0, sizeof(factory) ); factory.open(); MyFactory::server_type* server; factory.make_server( server, *client ); client->set_server( server ); n_available_hw_threads = server->default_concurrency(); client->expect_close_connection = true; server->request_close_connection(); // Client deletes itself when it sees call to acknowledge_close_connection from server. factory.close(); }
void DoClientSpecificVerification( MyServer&, int n_thread ) { MyClient* client = new MyClient; client->initialize( n_thread, Nesting(), ClientStackSize[0] ); MyFactory factory; memset( &factory, 0, sizeof(factory) ); MyFactory::status_type status = factory.open(); ASSERT( status!=MyFactory::st_not_found, "could not find RML library" ); ASSERT( status!=MyFactory::st_incompatible, NULL ); ASSERT( status==MyFactory::st_success, NULL ); MyFactory::server_type* server; status = factory.make_server( server, *client ); ASSERT( status==MyFactory::st_success, NULL ); client->set_server( server ); client->expect_close_connection = true; server->request_close_connection(); // Client deletes itself when it sees call to acknowledge_close_connection from server. factory.close(); }
CSSValueType HTMLList::GetStyleFromHTML(CSSPropertyType Property, CSSPropertyValue *pValue) { switch (Property) { case CSS_PROPERTY_PADDING_LEFT: pValue->length.type = CSS_LENGTH_UNIT_PX; pValue->length.val.dec = (short) WEBC_DEFAULT_LIST_INDENT; pValue->length.val.frac = 0; return (CSS_VALUE_SPECIFIED); case CSS_PROPERTY_LIST_STYLE_TYPE: if (mListStyleType != CSS_LIST_STYLE_NONE) { pValue->listStyleType = mListStyleType; return (CSS_VALUE_SPECIFIED); } break; case CSS_PROPERTY_LIST_STYLE_POSITION: pValue->listStylePosition = CSS_LIST_STYLE_POSITION_OUTSIDE; return (CSS_VALUE_SPECIFIED); case CSS_PROPERTY_MARGIN_BOTTOM: if (Nesting() == 0) { pValue->length.type = CSS_LENGTH_UNIT_EM; pValue->length.val.dec = 1; pValue->length.val.frac = 0; return (CSS_VALUE_SPECIFIED); } break; default: break; } return (CSS_VALUE_UNKNOWN); }