[complement-svn] SF.net SVN: complement: [1908] branches/complement-sockios/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-06-26 05:43:30
|
Revision: 1908 http://complement.svn.sourceforge.net/complement/?rev=1908&view=rev Author: complement Date: 2008-06-25 22:43:27 -0700 (Wed, 25 Jun 2008) Log Message: ----------- Review processing in sockmgr. Server's finalization still not work properly: problem in interrupted_server test on finalization (still read socket) in dbg mode. Modified Paths: -------------- branches/complement-sockios/explore/include/sockios/socksrv.cc branches/complement-sockios/explore/include/sockios/socksrv.h branches/complement-sockios/explore/include/sockios/sockstream branches/complement-sockios/explore/include/sockios/sp.cc branches/complement-sockios/explore/include/sockios/sp.h branches/complement-sockios/explore/lib/sockios/_sp.cc branches/complement-sockios/explore/lib/sockios/ut/sockios2_test.cc Modified: branches/complement-sockios/explore/include/sockios/socksrv.cc =================================================================== --- branches/complement-sockios/explore/include/sockios/socksrv.cc 2008-06-26 05:43:01 UTC (rev 1907) +++ branches/complement-sockios/explore/include/sockios/socksrv.cc 2008-06-26 05:43:27 UTC (rev 1908) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/11 21:41:27 yeti> +// -*- C++ -*- Time-stamp: <08/06/16 10:45:56 ptr> /* * Copyright (c) 2008 @@ -192,10 +192,18 @@ _in_work = false; // <--- set before cnd.notify_one(); (below in this func) } - std::tr2::lock_guard<std::tr2::mutex> lk2( rdlock ); - ready_pool.push_back( processor() ); // make ready_pool not empty - // std::cerr << "=== " << ready_pool.size() << std::endl; - cnd.notify_one(); + { + std::tr2::lock_guard<std::tr2::mutex> lk2( rdlock ); + ready_pool.push_back( processor() ); // make ready_pool not empty + // std::cerr << "=== " << ready_pool.size() << std::endl; + cnd.notify_one(); + } + + basic_socket<charT,traits,_Alloc>::mgr->final( *this ); + + if ( ploop.joinable() ) { + ploop.join(); + } } template <class Connect, class charT, class traits, class _Alloc, void (Connect::*C)( std::basic_sockstream<charT,traits,_Alloc>& )> Modified: branches/complement-sockios/explore/include/sockios/socksrv.h =================================================================== --- branches/complement-sockios/explore/include/sockios/socksrv.h 2008-06-26 05:43:01 UTC (rev 1907) +++ branches/complement-sockios/explore/include/sockios/socksrv.h 2008-06-26 05:43:27 UTC (rev 1908) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/11 21:40:56 yeti> +// -*- C++ -*- Time-stamp: <08/06/15 23:29:23 ptr> /* * Copyright (c) 2008 @@ -68,7 +68,6 @@ { sock_processor_base::close(); - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)this << " " << std::tr2::getpid() << std::endl; // Never uncomment next line: // basic_socket<charT,traits,_Alloc>::mgr->final( *this ); // this lead to virtual fuction call, that is already pure here. @@ -175,26 +174,7 @@ virtual ~connect_processor() { connect_processor::close(); - if ( ploop.joinable() ) { - ploop.join(); - } - // { - // std::tr2::lock_guard<std::tr2::mutex> lk( wklock ); - for ( typename worker_pool_t::iterator i = worker_pool.begin(); i != worker_pool.end(); ++i ) { - // delete i->second; - delete i->second.s; - delete i->second.c; - } - worker_pool.clear(); - // } - for ( typename ready_pool_t::iterator j = ready_pool.begin(); j != ready_pool.end(); ++j ) { - delete j->c; - } - ready_pool.clear(); - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)this << " " << std::tr2::getpid() << std::endl; - basic_socket<charT,traits,_Alloc>::mgr->final( *this ); - ((Init *)Init_buf)->~Init(); } Modified: branches/complement-sockios/explore/include/sockios/sockstream =================================================================== --- branches/complement-sockios/explore/include/sockios/sockstream 2008-06-26 05:43:01 UTC (rev 1907) +++ branches/complement-sockios/explore/include/sockios/sockstream 2008-06-26 05:43:27 UTC (rev 1908) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/11 14:45:16 yeti> +// -*- C++ -*- Time-stamp: <08/06/15 17:11:29 ptr> /* * Copyright (c) 1997-1999, 2002, 2003, 2005-2008 @@ -316,7 +316,7 @@ } #endif // _sock_processor_base::_idx = std::tr2::this_thread::xalloc(); - std::cerr << __FILE__ << ":" << __LINE__ << " new mgr " << std::tr2::getpid() << std::endl; + // std::cerr << __FILE__ << ":" << __LINE__ << " new mgr " << std::tr2::getpid() << std::endl; } } else { std::tr2::lock_guard<std::tr2::mutex> lk( _init_lock ); @@ -324,7 +324,7 @@ if ( basic_socket<charT,traits,_Alloc>::mgr == 0 ) { std::cerr << __FILE__ << ":" << __LINE__ << " shit happens\n"; } - std::cerr << __FILE__ << ":" << __LINE__ << " mgr destroyed " << std::tr2::getpid() << std::endl; + // std::cerr << __FILE__ << ":" << __LINE__ << " mgr destroyed " << std::tr2::getpid() << std::endl; delete basic_socket<charT,traits,_Alloc>::mgr; basic_socket<charT,traits,_Alloc>::mgr = 0; } Modified: branches/complement-sockios/explore/include/sockios/sp.cc =================================================================== --- branches/complement-sockios/explore/include/sockios/sp.cc 2008-06-26 05:43:01 UTC (rev 1907) +++ branches/complement-sockios/explore/include/sockios/sp.cc 2008-06-26 05:43:27 UTC (rev 1908) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/11 21:42:37 yeti> +// -*- C++ -*- Time-stamp: <08/06/16 11:05:56 ptr> /* * Copyright (c) 2008 @@ -134,90 +134,112 @@ void sockmgr<charT,traits,_Alloc>::process_listener( epoll_event& ev, typename sockmgr<charT,traits,_Alloc>::fd_container_type::iterator ifd ) { if ( ev.events & EPOLLRDHUP ) { - epoll_ctl( efd, EPOLL_CTL_DEL, ifd->first, 0 ); - // walk through descr and detach every .p ? + if ( epoll_ctl( efd, EPOLL_CTL_DEL, ifd->first, 0 ) < 0 ) { + // throw system_error + } + + if ( ifd->second.p != 0 ) { + ifd->second.p->close(); + } + descr.erase( ifd ); - std::cerr << "Remove listener EPOLLRDHUP\n"; - } else if ( ev.events & EPOLLIN ) { - sockaddr addr; - socklen_t sz = sizeof( sockaddr_in ); - fd_info info = ifd->second; + std::tr2::lock_guard<std::tr2::mutex> lck( cll ); + typename fd_container_type::iterator closed_ifd = closed_queue.find( ev.data.fd ); + if ( closed_ifd != closed_queue.end() && closed_ifd->second.p == ifd->second.p ) { + // listener in process of close + closed_queue.erase( closed_ifd ); + } - for ( ; ; ) { - int fd = accept( ev.data.fd, &addr, &sz ); - if ( fd < 0 ) { - std::cerr << "Accept, listener # " << ev.data.fd << ", errno " << errno << std::endl; - std::cerr << __FILE__ << ":" << __LINE__ << " " << std::tr2::getpid() << std::endl; - if ( (errno == EINTR) || (errno == ECONNABORTED) /* || (errno == ERESTARTSYS) */ ) { - continue; - } - if ( !(errno == EAGAIN || errno == EWOULDBLOCK) ) { - // std::cerr << "Accept, listener " << ev[i].data.fd << ", errno " << errno << std::endl; - // throw system_error ? - } -#if 0 - { - std::tr2::lock_guard<std::tr2::mutex> lck( cll ); - typename fd_container_type::iterator closed_ifd = closed_queue.find( ev.data.fd ); - if ( closed_ifd != closed_queue.end() ) { - typename fd_container_type::iterator ifd = descr.begin(); - for ( ; ifd != descr.end(); ) { - if ( ifd->second.p == closed_ifd->second.p ) { - descr.erase( ifd++ ); - } else { - ++ifd; - } - } - closed_queue.erase( closed_ifd ); - } - } -#endif - break; + return; + } + + if ( (ev.events & EPOLLIN) == 0 ) { + return; // I don't know what to do this case... + } + + { + std::tr2::lock_guard<std::tr2::mutex> lck( cll ); + typename fd_container_type::iterator closed_ifd = closed_queue.find( ev.data.fd ); + if ( closed_ifd != closed_queue.end() && closed_ifd->second.p == ifd->second.p ) { + // listener in process of closing, ignore all incoming connects + closed_queue.erase( closed_ifd ); + if ( epoll_ctl( efd, EPOLL_CTL_DEL, ifd->first, 0 ) < 0 ) { + // throw system_error } - // std::cerr << "listener accept " << fd << std::endl; - if ( fcntl( fd, F_SETFL, fcntl( fd, F_GETFL ) | O_NONBLOCK ) != 0 ) { - throw std::runtime_error( "can't establish nonblock mode" ); - } - - try { - std::cerr << __FILE__ << ":" << __LINE__ << " new sockstream_t" << std::endl; - sockbuf_t* b = (*info.p)( fd, addr ); + descr.erase( ifd ); + return; + } + } - epoll_event ev_add; - ev_add.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT; - ev_add.data.fd = fd; - fd_info new_info = { fd_info::owner, b, info.p }; - descr[fd] = new_info; + sockaddr addr; + socklen_t sz = sizeof( sockaddr_in ); - if ( epoll_ctl( efd, EPOLL_CTL_ADD, fd, &ev_add ) < 0 ) { - std::cerr << "Accept, add " << fd << ", errno " << errno << std::endl; - descr.erase( fd ); + fd_info info = ifd->second; + + for ( ; ; ) { + int fd = accept( ev.data.fd, &addr, &sz ); + if ( fd < 0 ) { + // std::cerr << "Accept, listener # " << ev.data.fd << ", errno " << errno << std::endl; + // std::cerr << __FILE__ << ":" << __LINE__ << " " << std::tr2::getpid() << std::endl; + if ( (errno == EINTR) || (errno == ECONNABORTED) /* || (errno == ERESTARTSYS) */ ) { + errno = 0; + continue; + } + if ( !(errno == EAGAIN /* || errno == EWOULDBLOCK */ ) ) { // EWOULDBLOCK == EAGAIN + // std::cerr << "Accept, listener " << ev.data.fd << ", errno " << errno << std::endl; + if ( epoll_ctl( efd, EPOLL_CTL_DEL, ifd->first, 0 ) < 0 ) { // throw system_error } - bool in_closed = false; - { - std::tr2::lock_guard<std::tr2::mutex> lk( cll ); - typename fd_container_type::iterator closed_ifd = closed_queue.begin(); - for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { - if ( closed_ifd->second.p == info.p ) { - in_closed = true; - std::cerr << "@@@ 1\n" << std::endl; - break; - } - } + if ( ifd->second.p != 0 ) { + ifd->second.p->close(); } + + descr.erase( ifd ); + + // check closed_queue, due to ifd->second.p->close(); add record in it + std::tr2::lock_guard<std::tr2::mutex> lck( cll ); + typename fd_container_type::iterator closed_ifd = closed_queue.find( ev.data.fd ); + if ( closed_ifd != closed_queue.end() && closed_ifd->second.p == ifd->second.p ) { + // listener in process of close + closed_queue.erase( closed_ifd ); + } + // throw system_error ? + } else { // back to listen + errno = 0; + epoll_event xev; + xev.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT; + xev.data.fd = ev.data.fd; + epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ); } - catch ( const std::bad_alloc& ) { - // nothing - } - catch ( ... ) { + return; + } + if ( fcntl( fd, F_SETFL, fcntl( fd, F_GETFL ) | O_NONBLOCK ) != 0 ) { + throw std::runtime_error( "can't establish nonblock mode" ); + } + + try { + sockbuf_t* b = (*info.p)( fd, addr ); + + epoll_event ev_add; + ev_add.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT; + ev_add.data.fd = fd; + fd_info new_info = { fd_info::owner, b, info.p }; + descr[fd] = new_info; + + if ( epoll_ctl( efd, EPOLL_CTL_ADD, fd, &ev_add ) < 0 ) { descr.erase( fd ); + // throw system_error } } - } else { - // std::cerr << "listener: " << std::hex << ev.events << std::dec << std::endl; + catch ( const std::bad_alloc& ) { + // nothing + descr.erase( fd ); + } + catch ( ... ) { + descr.erase( fd ); + } } } @@ -228,11 +250,13 @@ if ( ev.events & EPOLLIN ) { if ( (info.flags & fd_info::owner) == 0 ) { - // marginal case: me not owner (registerd via push(), - // when I owner, I know destroy point), - // already closed, but I not see closed event yet; - // object may be deleted already, so I can't - // call b->egptr() etc. here + /* + marginal case: sockmgr isn't owner (registerd via push(), + when I owner, I know destroy point), + already closed, but I don't see closed event yet; + object may be deleted already, so I can't + call b->egptr() etc. here + */ std::tr2::lock_guard<std::tr2::mutex> lck( cll ); typename fd_container_type::iterator closed_ifd = closed_queue.find( ev.data.fd ); if ( closed_ifd != closed_queue.end() ) { @@ -262,26 +286,12 @@ xev.data.fd = ev.data.fd; info.flags |= fd_info::level_triggered; if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ) < 0 ) { - std::cerr << "X " << ev.data.fd << ", " << errno << std::endl; + // std::cerr << "X " << ev.data.fd << ", " << errno << std::endl; } } - std::cerr << "Z " << ev.data.fd << ", " << errno << std::endl; + // std::cerr << "Z " << ev.data.fd << ", " << errno << std::endl; if ( info.p != 0 ) { // or (info.flags & fd_info::owner) != 0 - bool is_closed = false; - { - std::tr2::lock_guard<std::tr2::mutex> lk( cll ); - typename fd_container_type::iterator closed_ifd = closed_queue.begin(); - for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { - if ( closed_ifd->second.p == info.p ) { - is_closed = true; - std::cerr << "@@@ 2\n" << std::endl; - break; - } - } - } - if ( !is_closed ) { - (*info.p)( ev.data.fd ); - } + (*info.p)( ev.data.fd ); } break; } @@ -289,28 +299,29 @@ long offset = read( ev.data.fd, b->egptr(), sizeof(charT) * (b->_ebuf - b->egptr()) ); // std::cerr << "offset " << offset << ", " << errno << std::endl; if ( offset < 0 ) { - if ( (errno == EAGAIN) || (errno == EINTR) ) { - errno = 0; - epoll_event xev; - xev.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT; - xev.data.fd = ev.data.fd; - epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ); - break; - } else { - switch ( errno ) { - // case EINTR: // read was interrupted - // continue; - // break; - case EFAULT: // Bad address - case ECONNRESET: // Connection reset by peer - ev.events |= EPOLLRDHUP; // will be processed below - break; - default: - // std::cerr << "not listener, other " << ev.data.fd << std::hex << ev.events << std::dec << " : " << errno << std::endl; - break; - } - break; + switch ( errno ) { + case EINTR: // read was interrupted + errno = 0; + continue; + break; + case EFAULT: // Bad address + case ECONNRESET: // Connection reset by peer + ev.events |= EPOLLRDHUP; // will be processed below + break; + case EAGAIN: + // case EWOULDBLOCK: + { + epoll_event xev; + xev.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT; + xev.data.fd = ev.data.fd; + epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ); + } + break; + default: + // std::cerr << "not listener, other " << ev.data.fd << std::hex << ev.events << std::dec << " : " << errno << std::endl; + break; } + break; } else if ( offset > 0 ) { offset /= sizeof(charT); // if offset % sizeof(charT) != 0, rest will be lost! @@ -320,39 +331,22 @@ xev.data.fd = ev.data.fd; info.flags &= ~static_cast<unsigned>(fd_info::level_triggered); if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ) < 0 ) { - std::cerr << "Y " << ev.data.fd << ", " << errno << std::endl; + // std::cerr << "Y " << ev.data.fd << ", " << errno << std::endl; } } std::tr2::lock_guard<std::tr2::mutex> lk( b->ulck ); b->setg( b->eback(), b->gptr(), b->egptr() + offset ); b->ucnd.notify_one(); if ( info.p != 0 ) { - // std::cerr << "data here" << std::endl; - bool is_closed = false; - { - std::tr2::lock_guard<std::tr2::mutex> lk( cll ); - typename fd_container_type::iterator closed_ifd = closed_queue.begin(); - for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { - if ( closed_ifd->second.p == info.p ) { - is_closed = true; - std::cerr << "@@@ 3\n" << std::endl; - break; - } - } - } - if ( !is_closed ) { - (*info.p)( ev.data.fd ); - } + (*info.p)( ev.data.fd ); } } else { - std::cerr << "K " << ev.data.fd << ", " << errno << std::endl; + // std::cerr << "K " << ev.data.fd << ", " << errno << std::endl; // EPOLLRDHUP may be missed in kernel, but offset 0 is the same ev.events |= EPOLLRDHUP; // will be processed below break; } } - } else { - std::cerr << "Q\n"; } if ( (ev.events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR) ) != 0 ) { @@ -360,36 +354,15 @@ if ( epoll_ctl( efd, EPOLL_CTL_DEL, ifd->first, 0 ) < 0 ) { // throw system_error } - bool need_delete = true; + if ( info.p != 0 ) { - std::cerr << __FILE__ << ":" << __LINE__ << endl; - { - std::tr2::lock_guard<std::tr2::mutex> lk( cll ); - typename fd_container_type::iterator closed_ifd = closed_queue.begin(); - for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { - if ( closed_ifd->second.p == info.p ) { - need_delete = false; // will be deleted in 'final' method - std::cerr << "@@@ 4\n" << std::endl; - break; - } - } - } - if ( need_delete ) { - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)info.b << std::endl; - (*info.p)( ifd->first, typename socks_processor_t::adopt_close_t() ); - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)info.b << std::endl; - } + (*info.p)( ifd->first, typename socks_processor_t::adopt_close_t() ); } - if ( (info.flags & fd_info::owner) != 0 && need_delete ) { - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)info.b << std::endl; - } else { - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)info.b << std::endl; - if ( (info.flags & fd_info::buffer) != 0 ) { - info.b->close(); - } - std::tr2::lock_guard<std::tr2::mutex> lck( cll ); - closed_queue.erase( ev.data.fd ); + if ( (info.flags & fd_info::buffer) != 0 ) { + info.b->close(); } + std::tr2::lock_guard<std::tr2::mutex> lck( cll ); + closed_queue.erase( ev.data.fd ); descr.erase( ifd ); } // if ( ev.events & EPOLLHUP ) { @@ -433,11 +406,12 @@ std::tr2::lock_guard<std::tr2::mutex> lk( cll ); - // I can't use closed_queue.erase( p.fd() ) here: fd is -1 already - for ( typename fd_container_type::iterator closed_ifd = closed_queue.begin(); closed_ifd != closed_queue.end(); ++closed_ifd ) { + // I can't use closed_queue.erase( p.fd() ) here: fd is -1 already + for ( typename fd_container_type::iterator closed_ifd = closed_queue.begin(); closed_ifd != closed_queue.end(); ) { if ( closed_ifd->second.p == &p ) { - closed_queue.erase( closed_ifd ); - break; + closed_queue.erase( closed_ifd++ ); + } else { + ++closed_ifd; } } } Modified: branches/complement-sockios/explore/include/sockios/sp.h =================================================================== --- branches/complement-sockios/explore/include/sockios/sp.h 2008-06-26 05:43:01 UTC (rev 1907) +++ branches/complement-sockios/explore/include/sockios/sp.h 2008-06-26 05:43:27 UTC (rev 1908) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/11 21:05:35 yeti> +// -*- C++ -*- Time-stamp: <08/06/15 23:21:50 ptr> /* * Copyright (c) 2008 @@ -185,7 +185,6 @@ fd_info info = { fd_info::listener, 0, &p }; std::tr2::lock_guard<std::tr2::mutex> lk( cll ); closed_queue[_fd] = info; - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)&p << " " << std::tr2::getpid() << std::endl; } void final( socks_processor_t& p ); @@ -195,7 +194,6 @@ fd_info info = { 0, 0, 0 }; std::tr2::lock_guard<std::tr2::mutex> lk( cll ); closed_queue[fd] = info; - std::cerr << __FILE__ << ":" << __LINE__ << " " << (void*)b << " " << std::tr2::getpid() << std::endl; } private: Modified: branches/complement-sockios/explore/lib/sockios/_sp.cc =================================================================== --- branches/complement-sockios/explore/lib/sockios/_sp.cc 2008-06-26 05:43:01 UTC (rev 1907) +++ branches/complement-sockios/explore/lib/sockios/_sp.cc 2008-06-26 05:43:27 UTC (rev 1908) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/03/06 12:09:33 ptr> +// -*- C++ -*- Time-stamp: <08/06/13 22:59:17 ptr> /* * Copyright (c) 1997-1999, 2002, 2003, 2005-2008 @@ -17,7 +17,7 @@ #include <config/feature.h> #include <cerrno> -#include <sockios/sockstream2> +#include <sockios/sockstream> #ifdef STLPORT _STLP_BEGIN_NAMESPACE Modified: branches/complement-sockios/explore/lib/sockios/ut/sockios2_test.cc =================================================================== --- branches/complement-sockios/explore/lib/sockios/ut/sockios2_test.cc 2008-06-26 05:43:01 UTC (rev 1907) +++ branches/complement-sockios/explore/lib/sockios/ut/sockios2_test.cc 2008-06-26 05:43:27 UTC (rev 1908) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/06/11 21:46:19 yeti> +// -*- C++ -*- Time-stamp: <08/06/15 21:52:52 ptr> /* * @@ -300,7 +300,7 @@ bool rd_counter1() { - return worker::rd == 1; + return worker::rd > 0; // == 1; } int EXAM_IMPL(sockios2_test::processor_core) @@ -311,7 +311,6 @@ EXAM_CHECK( prss.good() ); EXAM_CHECK( prss.is_open() ); - std::cerr << __FILE__ << ":" << __LINE__ << " " << std::tr2::getpid() << std::endl; { sockstream s( "localhost", 2008 ); @@ -329,7 +328,6 @@ EXAM_CHECK( worker::visits == 1 ); worker::visits = 0; } - std::cerr << __FILE__ << ":" << __LINE__ << " " << std::tr2::getpid() << std::endl; } { lock_guard<mutex> lk( worker::lock ); @@ -415,7 +413,7 @@ } unique_lock<mutex> lk( worker::lock ); - worker::cnd.timed_wait( lk, milliseconds( 100 ), rd_counter1 ); + worker::cnd.timed_wait( lk, milliseconds( 500 ), rd_counter1 ); // cerr << worker::line << endl; EXAM_CHECK( worker::line == "Hello, world!" ); @@ -456,8 +454,6 @@ this_thread::fork(); - std::cerr << __FILE__ << ":" << __LINE__ << " " << std::tr2::getpid() << std::endl; - { connect_processor<worker> prss( 2008 ); @@ -474,8 +470,6 @@ EXAM_CHECK_ASYNC( worker::visits == 1 ); } - std::cerr << __FILE__ << ":" << __LINE__ << " " << std::tr2::getpid() << std::endl; - exit( 0 ); } catch ( std::tr2::fork_in_parent& child ) { @@ -626,16 +620,16 @@ int n = 1; - cerr << "align 3\n"; + // cerr << "align 3\n"; bb->wait(); // <-- align 3 - cerr << "align 3 pass\n"; + // cerr << "align 3 pass\n"; s.write( (const char *)&n, sizeof( int ) ).flush(); EXAM_CHECK_ASYNC( s.good() ); } ~interrupted_writer() - { cerr << "~~\n"; } + { /* cerr << "~~\n"; */ } void connect( sockstream& s ) { } @@ -645,9 +639,9 @@ sockstream s( "localhost", 2008 ); int buff = 0; - cerr << "align 2" << endl; + // cerr << "align 2" << endl; b->wait(); // <-- align 2 - cerr << "align pass" << endl; + // cerr << "align pass" << endl; EXAM_CHECK_ASYNC( s.read( (char *)&buff, sizeof(int) ).good() ); // <---- key line EXAM_CHECK_ASYNC( buff == 1 ); @@ -681,12 +675,12 @@ bb.wait(); // <-- align 2 - cerr << "system" << endl; + // cerr << "system" << endl; system( "echo > /dev/null" ); // <------ key line - cerr << "after system" << endl; + // cerr << "after system" << endl; bnew.wait(); // <-- align 3 - cerr << "after align 3" << endl; + // cerr << "after align 3" << endl; t.join(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |