complement-svn Mailing List for Complement
Status: Pre-Alpha
Brought to you by:
complement
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(61) |
Nov
(76) |
Dec
(39) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(33) |
Feb
(41) |
Mar
(16) |
Apr
|
May
(22) |
Jun
(14) |
Jul
(64) |
Aug
(60) |
Sep
(35) |
Oct
(34) |
Nov
(10) |
Dec
(5) |
| 2008 |
Jan
(4) |
Feb
(24) |
Mar
(10) |
Apr
(30) |
May
(15) |
Jun
(50) |
Jul
(20) |
Aug
(7) |
Sep
(8) |
Oct
(10) |
Nov
|
Dec
|
|
From: <com...@us...> - 2008-10-13 10:40:06
|
Revision: 1978
http://complement.svn.sourceforge.net/complement/?rev=1978&view=rev
Author: complement
Date: 2008-10-13 10:39:50 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
Simplest test for server stalling after client close connection
Server side stack (i.e. child process):
\#0 0xb80d3424 in __kernel_vsyscall ()
\#1 0xb7f63535 in pthread_join () from /lib/libpthread.so.0
\#2 0xb80c3738 in stlp_std::tr2::thread_base::join (this=0xbfbee488) at thread.cc:394
\#3 0x08085702 in ~connect_processor (this=0xbfbee310) at ../../../include/sockios/socksrv.h:255
\#4 0x08060694 in sockios2_test::disconnect_rawclnt (this=0xbfbee94e, __exam_ts=0xbfbee8cc,
__exam_counter=0) at sockios2_test.cc:638
\#5 0x0808ca6a in exam::detail::method_invoker<sockios2_test>::operator() (this=0x9aae63c,
ts=0xbfbee8cc, count=0) at ../../../include/exam/suite.h:95
\#6 0x0808ca8e in exam::detail::call_impl_t<exam::detail::method_invoker<sockios2_test> >::invoke (
this=0x9aae638, s=0xbfbee8cc, count=0) at ../../../include/exam/suite.h:54
\#7 0xb80837ac in exam::detail::call::operator() (this=0x9aae638, ts=0xbfbee8cc, count=0)
at ../../include/exam/suite.h:119
\#8 0xb8083843 in exam::detail::test_case::operator() (this=0x9aae638, ts=0xbfbee8cc, count=0)
at ../../include/exam/suite.h:138
\#9 0xb8081bde in exam::test_suite::run_test_case (this=0xbfbee8cc, v=16, n=0) at suite.cc:255
\#10 0xb80822c5 in exam::test_suite::single (this=0xbfbee8cc, one=16) at suite.cc:125
\#11 0x0808ab8a in main (argc=1, argv=0xbfbeedb4) at sockios_test_suite.cc:135
(gdb) info threads
3 Thread 0xb7d63b90 (LWP 17358) 0xb80d3424 in __kernel_vsyscall ()
2 Thread 0xb7562b90 (LWP 17359) 0xb80d3424 in __kernel_vsyscall ()
1 Thread 0xb7d648e0 (LWP 17357) 0xb80d3424 in __kernel_vsyscall ()
\#0 0xb80d3424 in __kernel_vsyscall ()
\#1 0xb7f666c5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
\#2 0x0807d439 in stlp_std::tr2::__condition_variable<false>::wait (this=0x9aaf564, lock=@0xb75621b8)
at ../../../include/mt/condition_variable:104
\#3 0x0807d4d4 in stlp_std::tr2::__condition_variable<false>::wait<stlp_std::basic_sockbuf<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::rdready_t> (this=0x9aaf564, lock=@0xb75621b8, pred=
{b = @0x9aaf4dc}) at ../../../include/mt/condition_variable:116
\#4 0x0807d62d in stlp_std::basic_sockbuf<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::underflow (this=0x9aaf4dc) at ../../../include/sockios/sockstream.cc:325
\#5 0x0806258e in stlp_std::basic_streambuf<char, stlp_std::char_traits<char> >::uflow (this=0x9aaf4dc)
at /export/home/ptr/STLport.lab/STLport/stlport/stl/_streambuf.c:165
\#6 0x08061d72 in stlp_std::basic_streambuf<char, stlp_std::char_traits<char> >::sbumpc (
this=0x9aaf4dc) at /export/home/ptr/STLport.lab/STLport/stlport/stl/_streambuf.h:229
\#7 0x0807f4d9 in stlp_std::priv::__read_unbuffered<char, stlp_std::char_traits<char>, stlp_std::priv::_Constant_unary_fun<bool, int> > (__that=0x9aaf4d0, __buf=0x9aaf4dc, _Num=4,
__s=0xb75622b8 "1234$?\222\006\b\020?\228?\190?\191?\204?\227?\190?\191?\248\"V?\183?\215?\218\a\b?\236\"V?\183?\160?\243?\170\t\020?\227?\190?\191", __is_delim={_M_val = false},
__extract_delim=false, __append_null=false, __is_getline=false)
at /export/home/ptr/STLport.lab/STLport/stlport/stl/_istream.c:597
\#8 0x0807fa75 in stlp_std::basic_istream<char, stlp_std::char_traits<char> >::read (this=0x9aaf4d0,
__s=0xb75622b8 "1234$?\222\006\b\020?\228?\190?\191?\204?\227?\190?\191?\248\"V?\183?\215?\218\a\b?\236\"V?\183?\160?\243?\170\t\020?\227?\190?\191", __n=4)
at /export/home/ptr/STLport.lab/STLport/stlport/stl/_istream.c:796
\#9 0x0807fb36 in srv_reader::connect (this=0x9aaf428, s=@0x9aaf4d0) at sockios2_test.cc:590
\#10 0x080830a9 in stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>::worker (this=0xbfbee310) at ../../../include/sockios/socksrv.cc:296
\#11 0x08083315 in stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>::loop (me=0xbfbee310) at ../../../include/sockios/socksrv.h:285
\#12 0x0806e932 in stlp_std::tr2::basic_thread<0u, 0u>::_call<void (*)(stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>*), stlp_std::connect_processor<srv_reader, char, stlp_std::char_traits<char>, stlp_std::allocator<char>, &(srv_reader::connect(stlp_std::basic_sockstream<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >&))>*> (
p=0xbfbee488) at ../../../include/mt/thread:477
\#13 0xb7f62120 in start_thread () from /lib/libpthread.so.0
\#14 0xb7eed3fe in clone () from /lib/libc.so.6
\#0 0xb80d3424 in __kernel_vsyscall ()
\#1 0xb7eedc06 in epoll_wait () from /lib/libc.so.6
\#2 0x08082202 in stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::io_worker (this=0x9aaf1d0) at ../../../include/sockios/sockmgr.cc:33
\#3 0x08082567 in stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >::_loop (me=0x9aaf1d0) at ../../../include/sockios/sockmgr.h:147
\#4 0x0806e622 in stlp_std::tr2::basic_thread<0u, 0u>::_call<void (*)(stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >*), stlp_std::detail::sockmgr<char, stlp_std::char_traits<char>, stlp_std::allocator<char> >*> (p=0x9aaf260) at ../../../include/mt/thread:477
\#5 0xb7f62120 in start_thread () from /lib/libpthread.so.0
\#6 0xb7eed3fe in clone () from /lib/libc.so.6
Modified Paths:
--------------
trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
trunk/complement/explore/lib/sockios/ut/sockios2_test.h
trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:39:06 UTC (rev 1977)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:39:50 UTC (rev 1978)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/09 01:43:37 ptr>
+// -*- C++ -*- Time-stamp: <08/10/10 23:20:58 ptr>
/*
*
@@ -599,6 +599,90 @@
std::tr2::condition_event srv_reader::cnd;
+int EXAM_IMPL(sockios2_test::disconnect_rawclnt)
+{
+ // throw exam::skip_exception();
+
+ const char fname[] = "/tmp/sockios2_test.shm";
+ xmt::shm_alloc<0> seg;
+
+ try {
+ seg.allocate( fname, 4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 );
+ }
+ catch ( xmt::shm_bad_alloc& err ) {
+ EXAM_ERROR( err.what() );
+ try {
+ seg.allocate( fname, 4096, 0, 0660 );
+ }
+ catch ( xmt::shm_bad_alloc& err2 ) {
+ EXAM_ERROR( err.what() );
+ return EXAM_RESULT;
+ }
+ }
+
+ xmt::allocator_shm<barrier_ip,0> shm;
+ barrier_ip& b = *new ( shm.allocate( 1 ) ) barrier_ip();
+
+ try {
+ this_thread::fork();
+
+ int res = 0;
+
+ {
+ connect_processor<srv_reader> prss( 2008 );
+
+ EXAM_CHECK_ASYNC_F( prss.good(), res );
+
+ b.wait();
+
+ EXAM_CHECK_ASYNC_F( srv_reader::cnd.timed_wait( milliseconds( 800 ) ), res );
+ // srv_reader::cnd.wait();
+ }
+
+ exit( res );
+ }
+ catch ( std::tr2::fork_in_parent& child ) {
+ b.wait();
+
+ char buf[] = "1234";
+
+ int fd = socket( PF_INET, SOCK_STREAM, 0 );
+
+ EXAM_CHECK( fd != 0 );
+
+ union sockaddr_t {
+ sockaddr_in inet;
+ sockaddr any;
+ } address;
+
+ int port = 2008;
+
+ address.inet.sin_family = AF_INET;
+ address.inet.sin_port = ((((port) >> 8) & 0xff) | (((port) & 0xff) << 8));
+ address.inet.sin_addr = std::findhost( "localhost" );
+
+ EXAM_CHECK( connect( fd, &address.any, sizeof( address ) ) != -1 );
+
+ EXAM_CHECK( ::write( fd, buf, 4 ) == 4 );
+
+ ::close( fd );
+
+ int stat = -1;
+ EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() );
+ if ( WIFEXITED(stat) ) {
+ EXAM_CHECK( WEXITSTATUS(stat) == 0 );
+ } else {
+ EXAM_ERROR( "child fail" );
+ }
+ }
+
+ shm.deallocate( &b );
+ seg.deallocate();
+ unlink( fname );
+
+ return EXAM_RESULT;
+}
+
int EXAM_IMPL(sockios2_test::disconnect)
{
throw exam::skip_exception();
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.h
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:39:06 UTC (rev 1977)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:39:50 UTC (rev 1978)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/09 00:36:27 ptr>
+// -*- C++ -*- Time-stamp: <08/10/10 23:05:17 ptr>
/*
*
@@ -23,6 +23,7 @@
int EXAM_DECL(srv_core);
int EXAM_DECL(connect_disconnect);
int EXAM_DECL(disconnect);
+ int EXAM_DECL(disconnect_rawclnt);
int EXAM_DECL(processor_core_one_local);
int EXAM_DECL(processor_core_two_local);
int EXAM_DECL(processor_core_getline);
Modified: trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:39:06 UTC (rev 1977)
+++ trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:39:50 UTC (rev 1978)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/09 00:39:27 ptr>
+// -*- C++ -*- Time-stamp: <08/10/10 23:22:23 ptr>
/*
*
@@ -88,6 +88,7 @@
t.add( &sockios2_test::srv_core, test2, "sockios2_test::srv_core" ) ) ) ) ) ) ) ) );
t.add( &sockios2_test::disconnect, test2, "sockios2_test::disconnect", tc[3] );
+ t.add( &sockios2_test::disconnect_rawclnt, test2, "disconnect raw client", tc[3] );
t.add( &sockios2_test::income_data, test2, "all data available after sockstream was closed, different processes", tc[4] );
Opts opts;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:39:16
|
Revision: 1977
http://complement.svn.sourceforge.net/complement/?rev=1977&view=rev
Author: complement
Date: 2008-10-13 10:39:06 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
test for trail-of-data with client and server in different processes
Result negative: as in case of the single process for client and
server, sometimes I can't read trailing data. Further investigation
required.
Allow srv_sigpipe test: it pass at fighter.
disconnect test fail and lead to deadlock.
read0 (i.e. test with SIGCHLD signal on read) pass at fighter.
Modified Paths:
--------------
trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
trunk/complement/explore/lib/sockios/ut/sockios2_test.h
trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:38:22 UTC (rev 1976)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:39:06 UTC (rev 1977)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/08 22:42:20 yeti>
+// -*- C++ -*- Time-stamp: <08/10/09 01:43:37 ptr>
/*
*
@@ -440,6 +440,26 @@
return EXAM_RESULT;
}
+
+/*
+ * If server and client both in the same process (sure?), server can
+ * see signal about close client socket _before_ it receive the rest of data
+ * (tcp stack implemenation dependent?).
+ * So sockios2_test::processor_core_income_data may not fill line
+ * with "Hello, world!".
+ *
+ * But if server and client situated in different processes, server will see
+ * FYN _after_ it read all data.
+ *
+ * Tests processor_core_income_data and income_data (below) are the same,
+ * except first has client and server in the same process, while second
+ * has server in child process. See commented line:
+ * // EXAM_CHECK( worker::line == "Hello, world!" ); // <-- may fail
+ * in the first test.
+ *
+ * Good text above. But wrong.
+ */
+
int EXAM_IMPL(sockios2_test::processor_core_income_data)
{
// check after sockstream was closed, i.e. ensure, that all data available
@@ -474,6 +494,88 @@
return EXAM_RESULT;
}
+int EXAM_IMPL(sockios2_test::income_data)
+{
+ const char fname[] = "/tmp/sockios2_test.shm";
+
+ // worker::lock.lock();
+ worker::visits = 0;
+ worker::line = "";
+ worker::rd = 0;
+ // worker::lock.unlock();
+
+ try {
+ xmt::shm_alloc<0> seg;
+ seg.allocate( fname, 4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0660 );
+
+ xmt::allocator_shm<barrier_ip,0> shm;
+ barrier_ip& b = *new ( shm.allocate( 1 ) ) barrier_ip();
+
+ try {
+
+ EXAM_CHECK( worker::visits == 0 );
+
+ this_thread::fork();
+
+ int res = 0;
+ {
+ connect_processor<worker> prss( 2008 );
+
+ EXAM_CHECK_ASYNC_F( worker::visits == 0, res );
+
+ b.wait(); // -- align here
+
+ EXAM_CHECK_ASYNC_F( prss.good(), res );
+ EXAM_CHECK_ASYNC_F( prss.is_open(), res );
+
+ {
+ unique_lock<mutex> lk( worker::lock );
+ EXAM_CHECK_ASYNC_F( worker::line_cnd.timed_wait( lk, milliseconds( 500 ), worker::rd_counter1 ), res );
+ }
+
+ {
+ unique_lock<mutex> lksrv( worker::lock );
+ EXAM_CHECK_ASYNC_F( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ), res );
+ }
+
+ EXAM_CHECK_ASYNC_F( worker::line == "Hello, world!", res ); // <-- may fail
+ }
+
+ exit( res );
+ }
+ catch ( std::tr2::fork_in_parent& child ) {
+ b.wait(); // -- align here
+
+ {
+ sockstream s1( "localhost", 2008 );
+
+ EXAM_CHECK( s1.good() );
+ EXAM_CHECK( s1.is_open() );
+
+ s1 << "Hello, world!" << endl;
+ }
+
+ int stat = -1;
+ EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() );
+ if ( WIFEXITED(stat) ) {
+ EXAM_CHECK( WEXITSTATUS(stat) == 0 );
+ } else {
+ EXAM_ERROR( "child interrupted" );
+ }
+
+ EXAM_CHECK( worker::visits == 0 );
+ }
+ shm.deallocate( &b );
+ seg.deallocate();
+ unlink( fname );
+ }
+ catch ( xmt::shm_bad_alloc& err ) {
+ EXAM_ERROR( err.what() );
+ }
+
+ return EXAM_RESULT;
+}
+
class srv_reader
{
public:
@@ -550,7 +652,7 @@
s.rdbuf()->shutdown( sock_base::stop_in | sock_base::stop_out );
- // s.close(); // should work with this line commened, but sorry
+ s.close(); // should work with this line commened, but sorry
int stat = -1;
EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() );
@@ -696,7 +798,7 @@
int EXAM_IMPL(sockios2_test::srv_sigpipe)
{
- throw exam::skip_exception();
+ // throw exam::skip_exception();
const char fname[] = "/tmp/sockios2_test.shm";
try {
@@ -754,9 +856,9 @@
EXAM_CHECK( r.good() );
EXAM_CHECK( r.is_open() );
- for ( int i = 0; i < 64; ++i ) { // give chance for system
- std::tr2::this_thread::yield();
- }
+ // for ( int i = 0; i < 64; ++i ) { // give chance for system
+ // std::tr2::this_thread::yield();
+ // }
}
shm.deallocate( &b );
seg.deallocate();
@@ -779,16 +881,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 )
{ }
@@ -798,12 +900,12 @@
sockstream s( "localhost", 2008 );
int buff = 0;
- cerr << "align 2" << endl;
+ // cerr << "align 2" << endl;
b->wait(); // <-- align 2
- cerr << "align 2 pass" << endl;
+ // cerr << "align 2 pass" << endl;
EXAM_CHECK_ASYNC( s.read( (char *)&buff, sizeof(int) ).good() ); // <---- key line
- cerr << "read pass" << endl;
+ // cerr << "read pass" << endl;
EXAM_CHECK_ASYNC( buff == 1 );
}
@@ -835,12 +937,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();
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.h
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:38:22 UTC (rev 1976)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:39:06 UTC (rev 1977)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/06 13:28:39 ptr>
+// -*- C++ -*- Time-stamp: <08/10/09 00:36:27 ptr>
/*
*
@@ -28,6 +28,7 @@
int EXAM_DECL(processor_core_getline);
int EXAM_DECL(processor_core_income_data);
int EXAM_DECL(fork);
+ int EXAM_DECL(income_data);
int EXAM_DECL(srv_sigpipe);
int EXAM_DECL(read0);
};
Modified: trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:38:22 UTC (rev 1976)
+++ trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:39:06 UTC (rev 1977)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/06 13:30:03 ptr>
+// -*- C++ -*- Time-stamp: <08/10/09 00:39:27 ptr>
/*
*
@@ -32,7 +32,7 @@
int main( int argc, const char** argv )
{
- exam::test_suite::test_case_type tc[4];
+ exam::test_suite::test_case_type tc[5];
exam::test_suite t( "libsockios test" );
@@ -79,7 +79,7 @@
t.add( &sockios2_test::read0, test2, "sockios2_test::read0",
t.add( &sockios2_test::srv_sigpipe, test2, "sockios2_test::srv_sigpipe",
- t.add( &sockios2_test::fork, test2, "sockios2_test::fork",
+ tc[4] = t.add( &sockios2_test::fork, test2, "sockios2_test::fork",
tc[3] = t.add( &sockios2_test::processor_core_income_data, test2, "all data available after sockstream was closed",
t.add( &sockios2_test::processor_core_getline, test2, "check income data before sockstream was closed",
t.add( &sockios2_test::processor_core_two_local, test2, "two local connects to connection processor",
@@ -88,6 +88,7 @@
t.add( &sockios2_test::srv_core, test2, "sockios2_test::srv_core" ) ) ) ) ) ) ) ) );
t.add( &sockios2_test::disconnect, test2, "sockios2_test::disconnect", tc[3] );
+ t.add( &sockios2_test::income_data, test2, "all data available after sockstream was closed, different processes", tc[4] );
Opts opts;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:38:30
|
Revision: 1976
http://complement.svn.sourceforge.net/complement/?rev=1976&view=rev
Author: complement
Date: 2008-10-13 10:38:22 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
Don't put closed sockets to worker_pool, if no data available
showmanyc (sockstream) check available data even for closed socket;
socksrv shouldn't push processor object associated with closed
socket and empty buffer to worker_pool---it can't receive data more.
If server and client both in the same process (sure?), server can
take signal on close client socket _before_ rest of data (tcp stack
implemenation dependent?). So sockios2_test::processor_core_income_data
may not read line. Check commented before clean this issue.
Modified Paths:
--------------
trunk/complement/explore/include/sockios/sockmgr.cc
trunk/complement/explore/include/sockios/socksrv.cc
trunk/complement/explore/include/sockios/sockstream
trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
Modified: trunk/complement/explore/include/sockios/sockmgr.cc
===================================================================
--- trunk/complement/explore/include/sockios/sockmgr.cc 2008-10-13 10:37:32 UTC (rev 1975)
+++ trunk/complement/explore/include/sockios/sockmgr.cc 2008-10-13 10:38:22 UTC (rev 1976)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/07 01:12:40 ptr>
+// -*- C++ -*- Time-stamp: <08/10/08 22:37:33 yeti>
/*
* Copyright (c) 2008
@@ -331,6 +331,7 @@
// throw system_error
}
if ( info.p != 0 ) { // ... but controlled by processor
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
(*info.p)( ifd->first, typename socks_processor_t::adopt_close_t() );
socks_processor_t* p = info.p;
Modified: trunk/complement/explore/include/sockios/socksrv.cc
===================================================================
--- trunk/complement/explore/include/sockios/socksrv.cc 2008-10-13 10:37:32 UTC (rev 1975)
+++ trunk/complement/explore/include/sockios/socksrv.cc 2008-10-13 10:38:22 UTC (rev 1976)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/07 00:00:28 ptr>
+// -*- C++ -*- Time-stamp: <08/10/08 22:35:57 yeti>
/*
* Copyright (c) 2008
@@ -201,7 +201,7 @@
if ( s->rdbuf()->in_avail() > 0 ) {
std::tr2::lock_guard<std::tr2::mutex> lk( rdlock );
ready_pool.push_back( processor( c, s ) );
- std::cerr << __FILE__ << ":" << __LINE__ << " " << fd << std::endl;
+ // std::cerr << __FILE__ << ":" << __LINE__ << " " << fd << std::endl;
cnd.notify_one();
} else {
std::tr2::lock_guard<std::tr2::mutex> lk( wklock );
@@ -235,6 +235,7 @@
if ( j != ready_pool.end() ) {
p = *j;
ready_pool.erase( j );
+ // std::cerr << __FILE__ << ":" << __LINE__ << " " << fd << std::endl;
}
}
if ( p.c != 0 ) {
@@ -296,13 +297,15 @@
if ( p.s->rdbuf()->in_avail() > 0 ) {
std::tr2::lock_guard<std::tr2::mutex> lk( rdlock );
ready_pool.push_back( p );
- } else {
+ } else if ( p.s->is_open() ) {
std::tr2::lock_guard<std::tr2::mutex> lk( wklock );
worker_pool[p.s->rdbuf()->fd()] = p;
+ // std::cerr << __FILE__ << ":" << __LINE__ << " " << p.s->is_open() << std::endl;
+ } else {
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
+ delete p.c;
+ delete p.s;
}
- // } // else {
- // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
- // }
}
}
catch ( const finish& ) {
Modified: trunk/complement/explore/include/sockios/sockstream
===================================================================
--- trunk/complement/explore/include/sockios/sockstream 2008-10-13 10:37:32 UTC (rev 1975)
+++ trunk/complement/explore/include/sockios/sockstream 2008-10-13 10:38:22 UTC (rev 1976)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/07 00:01:51 ptr>
+// -*- C++ -*- Time-stamp: <08/10/08 22:22:00 yeti>
/*
* Copyright (c) 1997-1999, 2002, 2003, 2005-2008
@@ -481,8 +481,15 @@
protected:
virtual streamsize showmanyc()
- { return basic_socket_t::_fd != -1 ? this->egptr() - this->gptr() : -1; }
+ {
+ streamsize n = this->egptr() - this->gptr();
+ if ( n > 0 ) {
+ return n;
+ }
+ return basic_socket_t::_fd != -1 ? 0 : -1;
+ }
+
virtual int_type underflow();
virtual int_type overflow( int_type c = traits::eof() );
virtual int_type pbackfail( int_type c = traits::eof() )
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:37:32 UTC (rev 1975)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:38:22 UTC (rev 1976)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/06 13:33:08 ptr>
+// -*- C++ -*- Time-stamp: <08/10/08 22:42:20 yeti>
/*
*
@@ -467,7 +467,7 @@
EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
}
- EXAM_CHECK( worker::line == "Hello, world!" );
+ // EXAM_CHECK( worker::line == "Hello, world!" ); // <-- may fail
worker::line = "";
worker::rd = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:37:42
|
Revision: 1975
http://complement.svn.sourceforge.net/complement/?rev=1975&view=rev
Author: complement
Date: 2008-10-13 10:37:32 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
temporary skip tests with problems
Modified Paths:
--------------
trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:36:55 UTC (rev 1974)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:37:32 UTC (rev 1975)
@@ -499,6 +499,8 @@
int EXAM_IMPL(sockios2_test::disconnect)
{
+ throw exam::skip_exception();
+
const char fname[] = "/tmp/sockios2_test.shm";
xmt::shm_alloc<0> seg;
@@ -694,6 +696,8 @@
int EXAM_IMPL(sockios2_test::srv_sigpipe)
{
+ throw exam::skip_exception();
+
const char fname[] = "/tmp/sockios2_test.shm";
try {
xmt::shm_alloc<0> seg;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:37:03
|
Revision: 1974
http://complement.svn.sourceforge.net/complement/?rev=1974&view=rev
Author: complement
Date: 2008-10-13 10:36:55 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
close client's connection in test (sockios2_test::fork)
Use *_ASYNC_F macros to report status of child process;
Test sockios2_test::disconnect still has problems:
- on server side sockbuf good even after shutdown (in both directions)
on client side;
- sockserver wait died client on close
Modified Paths:
--------------
trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:36:17 UTC (rev 1973)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:36:55 UTC (rev 1974)
@@ -522,18 +522,20 @@
try {
this_thread::fork();
- connect_processor<srv_reader> prss( 2008 );
+ int res = 0;
- EXAM_CHECK_ASYNC( prss.good() );
+ {
+ connect_processor<srv_reader> prss( 2008 );
- b.wait();
+ EXAM_CHECK_ASYNC_F( prss.good(), res );
- if ( srv_reader::cnd.timed_wait( milliseconds( 800 ) ) ) {
- exit( 0 );
+ b.wait();
+
+ EXAM_CHECK_ASYNC_F( srv_reader::cnd.timed_wait( milliseconds( 800 ) ), res );
+ // srv_reader::cnd.wait();
}
- // srv_reader::cnd.wait();
- exit( 1 );
+ exit( res );
}
catch ( std::tr2::fork_in_parent& child ) {
b.wait();
@@ -546,7 +548,7 @@
s.rdbuf()->shutdown( sock_base::stop_in | sock_base::stop_out );
- // s.close();
+ // s.close(); // should work with this line commened, but sorry
int stat = -1;
EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() );
@@ -592,19 +594,20 @@
this_thread::fork();
+ int res = 0;
{
connect_processor<worker> prss( 2008 );
- EXAM_CHECK_ASYNC( worker::visits == 0 );
+ EXAM_CHECK_ASYNC_F( worker::visits == 0, res );
b.wait(); // -- align here
- EXAM_CHECK_ASYNC( prss.good() );
- EXAM_CHECK_ASYNC( prss.is_open() );
+ EXAM_CHECK_ASYNC_F( prss.good(), res );
+ EXAM_CHECK_ASYNC_F( prss.is_open(), res );
{
unique_lock<mutex> lk( worker::lock );
- EXAM_CHECK_ASYNC( worker::cnd.timed_wait( lk, milliseconds( 500 ), worker::visits_counter1 ) );
+ EXAM_CHECK_ASYNC_F( worker::cnd.timed_wait( lk, milliseconds( 500 ), worker::visits_counter1 ) , res );
}
// for ( int i = 0; i < 64; ++i ) { // give chance for system
@@ -613,11 +616,11 @@
{
unique_lock<mutex> lksrv( worker::lock );
- EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
+ EXAM_CHECK_ASYNC_F( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ), res );
}
}
- exit( 0 );
+ exit( res );
}
catch ( std::tr2::fork_in_parent& child ) {
b.wait(); // -- align here
@@ -627,6 +630,8 @@
EXAM_CHECK( s.good() );
EXAM_CHECK( s.is_open() );
+ s.close();
+
int stat = -1;
EXAM_CHECK( waitpid( child.pid(), &stat, 0 ) == child.pid() );
if ( WIFEXITED(stat) ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:36:27
|
Revision: 1973
http://complement.svn.sourceforge.net/complement/?rev=1973&view=rev
Author: complement
Date: 2008-10-13 10:36:17 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
sock_processor_base should wait release from sock_mgr
sock_processor_base may be accessed from sock_mgr after death,
so reference counting added; sock_processor_base will pass dtor
after sock_mgr lost reference to it (i.e. all clients of
sock_processor detached and destroyed); the same thoughts for
pass pointer to sock_processor_base via pipe to sock_mgr.
sock_processor may inform sockmgr about termination via two channels:
i) via listener's descriptor (EPOLLRDHUP | EPOLLHUP | EPOLLERR, in
sockmgr<charT,traits,_Alloc>::process_listener);
ii) via command on pipe ('listener_on_exit').
Because i) may never happens (or occur after ii)), removing sock_processor
from sockmgr tables done only when ii) processing, and not done
when processing i).
Before clean issues above, in ~sock_processor_base() condition
wait with timeout and print line if timeout occur (signal about error);
in sock_processor_base::release() checked counter, and if it become
negative (i.e. extra release() call), print stack (this is a error,
because of possible access to destroyed object).
Modified Paths:
--------------
trunk/complement/explore/include/sockios/sockmgr.cc
trunk/complement/explore/include/sockios/sockmgr.h
trunk/complement/explore/include/sockios/socksrv.cc
trunk/complement/explore/include/sockios/socksrv.h
trunk/complement/explore/include/sockios/sockstream
Modified: trunk/complement/explore/include/sockios/sockmgr.cc
===================================================================
--- trunk/complement/explore/include/sockios/sockmgr.cc 2008-10-13 10:35:31 UTC (rev 1972)
+++ trunk/complement/explore/include/sockios/sockmgr.cc 2008-10-13 10:36:17 UTC (rev 1973)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/01 14:40:03 yeti>
+// -*- C++ -*- Time-stamp: <08/10/07 01:12:40 ptr>
/*
* Copyright (c) 2008
@@ -48,7 +48,7 @@
} else {
typename fd_container_type::iterator ifd = descr.find( ev[i].data.fd );
if ( ifd == descr.end() ) {
- // std::cerr << __FILE__ << ":" << __LINE__ << " " << ev[i].data.fd << std::endl;
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << ev[i].data.fd << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_DEL, ev[i].data.fd, 0 ) < 0 ) {
// throw system_error
}
@@ -91,17 +91,23 @@
switch ( _ctl.cmd ) {
case listener:
ev_add.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT;
+#if 1
+ ev_add.data.u64 = 0ULL;
+#endif
ev_add.data.fd = static_cast<socks_processor_t*>(_ctl.data.ptr)->fd();
if ( ev_add.data.fd >= 0 ) {
if ( fcntl( ev_add.data.fd, F_SETFL, fcntl( ev_add.data.fd, F_GETFL ) | O_NONBLOCK ) != 0 ) {
// std::cerr << "xxx " << errno << " " << std::tr2::getpid() << std::endl;
+ static_cast<socks_processor_t*>(_ctl.data.ptr)->release();
throw std::runtime_error( "can't establish nonblock mode on listener" );
}
if ( descr.find( ev_add.data.fd ) != descr.end() ) { // reuse?
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev_add.data.fd, &ev_add ) < 0 ) {
std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
// descr.erase( ev_add.data.fd );
// throw system_error
+ static_cast<socks_processor_t*>(_ctl.data.ptr)->release();
return;
}
} else {
@@ -109,6 +115,7 @@
if ( epoll_ctl( efd, EPOLL_CTL_ADD, ev_add.data.fd, &ev_add ) < 0 ) {
std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
// throw system_error
+ static_cast<socks_processor_t*>(_ctl.data.ptr)->release();
return;
}
}
@@ -117,9 +124,13 @@
break;
case tcp_buffer:
ev_add.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT;
+#if 1
+ ev_add.data.u64 = 0ULL;
+#endif
ev_add.data.fd = static_cast<sockbuf_t*>(_ctl.data.ptr)->fd();
if ( ev_add.data.fd >= 0 ) {
if ( descr.find( ev_add.data.fd ) != descr.end() ) { // reuse?
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev_add.data.fd, &ev_add ) < 0 ) {
std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
// descr.erase( ev_add.data.fd );
@@ -129,9 +140,8 @@
} else {
// std::cerr << __FILE__ << ":" << __LINE__ << " " << ev_add.data.fd << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_ADD, ev_add.data.fd, &ev_add ) < 0 ) {
- std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
- // throw system_error
- return;
+ // std::cerr << __FILE__ << ":" << __LINE__ << " " << system_error( posix_error::make_error_code( static_cast<posix_error::posix_errno>(errno) ) ).what() << std::endl;
+ return; // already closed?
}
}
descr[ev_add.data.fd] = fd_info( static_cast<sockbuf_t*>(_ctl.data.ptr) );
@@ -147,6 +157,7 @@
}
// dump_descr();
}
+ static_cast<socks_processor_t*>(_ctl.data.ptr)->release();
break;
case rqstop:
// std::cerr << "Stop request\n";
@@ -162,8 +173,9 @@
if ( ev.events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR) ) {
// std::cerr << __FILE__ << ":" << __LINE__ << " " << ifd->first << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_DEL, ifd->first, 0 ) < 0 ) {
- // throw system_error
- std::cerr << __FILE__ << ":" << __LINE__ << " " << ifd->first << " " << errno << std::endl;
+ // std::cerr << __FILE__ << ":" << __LINE__ << " " << ifd->first << " " << system_error( posix_error::make_error_code( static_cast<posix_error::posix_errno>(errno) ) ).what() << std::endl;
+
+ // already closed?
}
if ( ifd->second.p != 0 ) {
@@ -175,6 +187,7 @@
}
}
+#if 0 // do it once, after 'listener_on_exit' command via pipe
listeners_final.insert(static_cast<void *>(ifd->second.p));
// std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
@@ -188,6 +201,7 @@
if ( lfd != -1 ) {
descr.erase( lfd );
}
+#endif
// dump_descr();
@@ -245,7 +259,11 @@
errno = 0;
epoll_event xev;
xev.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT;
+#if 1
+ xev.data.u64 = 0ULL;
+#endif
xev.data.fd = ev.data.fd;
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ) < 0 ) {
std::cerr << __FILE__ << ":" << __LINE__ << " " << ev.data.fd << " "
<< errno << std::endl;
@@ -262,6 +280,9 @@
try {
epoll_event ev_add;
ev_add.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT;
+#if 1
+ ev_add.data.u64 = 0ULL;
+#endif
ev_add.data.fd = fd;
if ( descr.find( fd ) != descr.end() ) { // reuse?
@@ -338,6 +359,7 @@
xev.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP;
xev.data.fd = ev.data.fd;
info.flags |= fd_info::level_triggered;
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ) < 0 ) {
std::cerr << __FILE__ << ":" << __LINE__ << " " << ev.data.fd << " " << errno << std::endl;
}
@@ -367,7 +389,11 @@
{
epoll_event xev;
xev.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT;
+#if 1
+ xev.data.u64 = 0ULL;
+#endif
xev.data.fd = ev.data.fd;
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ) < 0 ) {
std::cerr << __FILE__ << ":" << __LINE__ << " " << ev.data.fd << " " << errno << std::endl;
}
@@ -386,6 +412,7 @@
xev.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP | EPOLLET | EPOLLONESHOT;
xev.data.fd = ev.data.fd;
info.flags &= ~static_cast<unsigned>(fd_info::level_triggered);
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_MOD, ev.data.fd, &xev ) < 0 ) {
std::cerr << __FILE__ << ":" << __LINE__ << " " << ev.data.fd << " " << errno << std::endl;
}
@@ -411,6 +438,7 @@
// std::cerr << __FILE__ << ":" << __LINE__ << " " << ifd->first << std::endl;
if ( info.p != 0 ) {
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( epoll_ctl( efd, EPOLL_CTL_DEL, ifd->first, 0 ) < 0 ) {
// throw system_error
std::cerr << __FILE__ << ":" << __LINE__ << " " << ifd->first << " " << errno << std::endl;
@@ -471,6 +499,7 @@
{
int myfd = -1;
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( !listeners_final.empty() ) {
// std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
if ( listeners_final.find( static_cast<void*>(p) ) != listeners_final.end() ) {
@@ -494,6 +523,7 @@
// if ( myfd != -1 ) {
// std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
p->stop();
+ p->release(); // socks_processor_t* p not under sockmgr control more
// }
}
}
Modified: trunk/complement/explore/include/sockios/sockmgr.h
===================================================================
--- trunk/complement/explore/include/sockios/sockmgr.h 2008-10-13 10:35:31 UTC (rev 1972)
+++ trunk/complement/explore/include/sockios/sockmgr.h 2008-10-13 10:36:17 UTC (rev 1973)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/09/08 23:18:28 ptr>
+// -*- C++ -*- Time-stamp: <08/10/07 01:11:58 ptr>
/*
* Copyright (c) 2008
@@ -49,6 +49,8 @@
#include <deque>
#include <functional>
+// #include <boost/shared_ptr.hpp>
+
namespace std {
template <class charT, class traits, class _Alloc> class basic_sockbuf;
@@ -128,7 +130,7 @@
{ }
unsigned flags;
- sockbuf_t* b;
+ sockbuf_t* b;
socks_processor_t* p;
};
@@ -148,6 +150,7 @@
sockmgr( int hint = 1024, int ret = 512 ) :
n_ret( ret )
{
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
efd = epoll_create( hint );
if ( efd < 0 ) {
// throw system_error( errno )
@@ -162,10 +165,14 @@
epoll_event ev_add;
ev_add.events = EPOLLIN | EPOLLRDHUP | EPOLLERR | EPOLLHUP;
+#if 1
+ ev_add.data.u64 = 0ULL;
+#endif
ev_add.data.fd = pipefd[0];
epoll_ctl( efd, EPOLL_CTL_ADD, pipefd[0], &ev_add );
_worker = new std::tr2::thread( _loop, this );
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
// ctl _ctl;
// _ctl.cmd = rqstart;
@@ -192,18 +199,22 @@
void push( socks_processor_t& p )
{
+ // std::cerr << __FILE__ << ":" << __LINE__ << " " << p.use_count() << std::endl;
ctl _ctl;
_ctl.cmd = listener;
_ctl.data.ptr = static_cast<void *>(&p);
+ p.addref();
int r = ::write( pipefd[1], &_ctl, sizeof(ctl) );
if ( r < 0 || r != sizeof(ctl) ) {
+ p.release();
throw std::runtime_error( "can't write to pipe" );
}
}
void push( sockbuf_t& s )
{
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
ctl _ctl;
_ctl.cmd = tcp_buffer;
_ctl.data.ptr = static_cast<void *>(&s);
@@ -221,14 +232,17 @@
_ctl.cmd = listener_on_exit;
_ctl.data.ptr = reinterpret_cast<void *>(&p);
+ p.addref();
int r = ::write( pipefd[1], &_ctl, sizeof(ctl) );
if ( r < 0 || r != sizeof(ctl) ) {
+ p.release();
throw std::runtime_error( "can't write to pipe" );
}
}
void exit_notify( sockbuf_t* b, sock_base::socket_type fd )
{
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
try {
std::tr2::unique_lock<std::tr2::mutex> lk( dll, std::tr2::defer_lock );
Modified: trunk/complement/explore/include/sockios/socksrv.cc
===================================================================
--- trunk/complement/explore/include/sockios/socksrv.cc 2008-10-13 10:35:31 UTC (rev 1972)
+++ trunk/complement/explore/include/sockios/socksrv.cc 2008-10-13 10:36:17 UTC (rev 1973)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/09 11:09:53 ptr>
+// -*- C++ -*- Time-stamp: <08/10/07 00:00:28 ptr>
/*
* Copyright (c) 2008
@@ -54,6 +54,7 @@
// so don't check return code from listen
::listen( basic_socket_t::_fd, SOMAXCONN );
basic_socket_t::mgr->push( *this );
+ // std::cerr << __FILE__ << ":" << __LINE__ << " " << count() << std::endl;
}
} else if ( prot == sock_base::local ) {
return;
Modified: trunk/complement/explore/include/sockios/socksrv.h
===================================================================
--- trunk/complement/explore/include/sockios/socksrv.h 2008-10-13 10:35:31 UTC (rev 1972)
+++ trunk/complement/explore/include/sockios/socksrv.h 2008-10-13 10:36:17 UTC (rev 1973)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/09 01:02:12 ptr>
+// -*- C++ -*- Time-stamp: <08/10/06 23:50:22 ptr>
/*
* Copyright (c) 2008
@@ -37,6 +37,10 @@
#include <functional>
#include <exception>
+// #include <boost/shared_ptr.hpp>
+
+#include <mt/callstack.h>
+
namespace std {
template <class charT, class traits, class _Alloc> class basic_sockbuf;
@@ -59,15 +63,51 @@
sock_processor_base() :
_mode( ios_base::in | ios_base::out ),
- _state( ios_base::goodbit )
+ _state( ios_base::goodbit ),
+ _chk( *this ),
+ _rcount( 0 )
{ }
- explicit sock_processor_base( int port, sock_base::stype t = sock_base::sock_stream )
+ explicit sock_processor_base( int port, sock_base::stype t = sock_base::sock_stream ) :
+ _chk( *this ),
+ _rcount( 0 )
{ sock_processor_base::open( port, t, sock_base::inet ); }
virtual ~sock_processor_base()
- { sock_processor_base::_close(); }
+ {
+ sock_processor_base::_close();
+ std::tr2::unique_lock<std::tr2::mutex> lk(_cnt_lck);
+ // _cnt_cnd.wait( lk, _chk );
+ if ( !_cnt_cnd.timed_wait( lk, std::tr2::seconds(1), _chk ) ) { // <-- debug
+ std::cerr << __FILE__ << ":" << __LINE__ << " " << _rcount << std::endl;
+ }
+ }
+
+ void addref()
+ {
+ std::tr2::lock_guard<std::tr2::mutex> lk(_cnt_lck);
+ ++_rcount;
+ }
+
+ void release()
+ {
+ std::tr2::lock_guard<std::tr2::mutex> lk(_cnt_lck);
+ if ( --_rcount == 0 ) {
+ _cnt_cnd.notify_one();
+ }
+ if ( _rcount < 0 ) { // <-- debug
+ xmt::callstack( std::cerr );
+ }
+ }
+
+ int count()
+ {
+ std::tr2::lock_guard<std::tr2::mutex> lk(_cnt_lck);
+ int tmp = _rcount;
+ return tmp;
+ }
+
void open( const in_addr& addr, int port, sock_base::stype type, sock_base::protocol prot );
void open( unsigned long addr, int port, sock_base::stype type, sock_base::protocol prot )
@@ -138,6 +178,28 @@
protected:
std::tr2::mutex _fd_lck;
+
+ class _cnt_checker
+ {
+ public:
+ _cnt_checker( sock_processor_base<charT,traits,_Alloc>& _p ) :
+ p( _p )
+ { }
+
+ private:
+ sock_processor_base<charT,traits,_Alloc>& p;
+
+ public:
+ bool operator ()() const
+ { return p._rcount == 0; }
+ };
+
+ _cnt_checker _chk;
+ std::tr2::mutex _cnt_lck;
+ std::tr2::condition_variable _cnt_cnd;
+ int _rcount;
+
+ friend class _cnt_checker;
};
typedef sock_processor_base<char,char_traits<char>,allocator<char> > sock_basic_processor;
Modified: trunk/complement/explore/include/sockios/sockstream
===================================================================
--- trunk/complement/explore/include/sockios/sockstream 2008-10-13 10:35:31 UTC (rev 1972)
+++ trunk/complement/explore/include/sockios/sockstream 2008-10-13 10:36:17 UTC (rev 1973)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/01 00:27:31 ptr>
+// -*- C++ -*- Time-stamp: <08/10/07 00:01:51 ptr>
/*
* Copyright (c) 1997-1999, 2002, 2003, 2005-2008
@@ -306,6 +306,7 @@
if ( direction ) {
std::tr2::lock_guard<std::tr2::mutex> lk( _init_lock );
if ( _count++ == 0 ) {
+ // std::cerr << __FILE__ << ":" << __LINE__ << std::endl;
basic_socket<charT,traits,_Alloc>::mgr = new std::detail::sockmgr<charT,traits,_Alloc>();
#ifdef __FIT_PTHREADS
if ( !_at_fork ) { // call only once
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:35:42
|
Revision: 1972
http://complement.svn.sourceforge.net/complement/?rev=1972&view=rev
Author: complement
Date: 2008-10-13 10:35:31 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
turn on detection of call stack feature
callstack require BFD interface and bfd lib; but it very useful
for detection of exception origin; system_error.cc contains now
only commented calls of callstack---usage should be reviewed.
Modified Paths:
--------------
trunk/complement/explore/include/config/feature.h
trunk/complement/explore/lib/mt/Makefile
trunk/complement/explore/lib/mt/callstack.cc
trunk/complement/explore/lib/mt/system_error.cc
Modified: trunk/complement/explore/include/config/feature.h
===================================================================
--- trunk/complement/explore/include/config/feature.h 2008-10-13 10:34:44 UTC (rev 1971)
+++ trunk/complement/explore/include/config/feature.h 2008-10-13 10:35:31 UTC (rev 1972)
@@ -126,7 +126,7 @@
impossible without BFD (Binary File Descriptor).
*/
-#define __FIT_DISABLE_BFD
+// #define __FIT_DISABLE_BFD
#ifdef __FIT_DISABLE_BFD
# ifdef __FIT_PRESENT_BFD
Modified: trunk/complement/explore/lib/mt/Makefile
===================================================================
--- trunk/complement/explore/lib/mt/Makefile 2008-10-13 10:34:44 UTC (rev 1971)
+++ trunk/complement/explore/lib/mt/Makefile 2008-10-13 10:35:31 UTC (rev 1972)
@@ -9,7 +9,7 @@
HEADERS_BASE = $(SRCROOT)/include/mt $(SRCROOT)/include/config $(SRCROOT)/include/misc
# LDLIBS += -ldl -lbfd
-LDLIBS += -ldl
+LDLIBS += -ldl -lbfd
check: all-shared
$(MAKE) -C ut all-shared
Modified: trunk/complement/explore/lib/mt/callstack.cc
===================================================================
--- trunk/complement/explore/lib/mt/callstack.cc 2008-10-13 10:34:44 UTC (rev 1971)
+++ trunk/complement/explore/lib/mt/callstack.cc 2008-10-13 10:35:31 UTC (rev 1972)
@@ -233,16 +233,16 @@
}
#endif
- // int res;
+ int res;
// if ( string( "obj/gcc/so_g/mt_ut" ) == dlinfo.dli_fname ) {
- if ( /* (res = extract_info( dlinfo.dli_fname, ip, file, line )) != 0 */ false ) {
+ if ( (res = extract_info( dlinfo.dli_fname, ip, file, line )) != 0 /* false */ ) {
file = "??";
line = 0;
// s << "*** " << res << " " << dlinfo.dli_fname << endl;
} else {
- file = "??";
- line = 0;
+ // file = "??";
+ // line = 0;
}
// } else {
// file = "??";
Modified: trunk/complement/explore/lib/mt/system_error.cc
===================================================================
--- trunk/complement/explore/lib/mt/system_error.cc 2008-10-13 10:34:44 UTC (rev 1971)
+++ trunk/complement/explore/lib/mt/system_error.cc 2008-10-13 10:35:31 UTC (rev 1972)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/10/01 00:22:12 ptr>
+// -*- C++ -*- Time-stamp: <08/10/07 01:02:13 ptr>
/*
* Copyright (c) 2007-2008
@@ -13,6 +13,9 @@
#include "mt/system_error"
#include <cerrno>
+#include "mt/callstack.h"
+#include <sstream>
+#include <iostream>
#if 0
#ifdef STLPORT
@@ -996,30 +999,48 @@
bool operator !=( const error_condition& l, const error_condition& r )
{ return !(l == r); }
+// char _stack_buf[4096];
+
system_error::system_error( error_code code, const string& what ) :
runtime_error( what ),
ecode_( code.value(), code.category() ),
_dbuf( 0 )
-{ }
+{
+ // stringstream s;
+ // xmt::callstack( cerr );
+ // strcpy( _stack_buf, s.str().c_str() );
+}
system_error::system_error( error_code code ) :
runtime_error( "" ),
ecode_( code.value(), code.category() ),
_dbuf( 0 )
-{ }
+{
+ // stringstream s;
+ // xmt::callstack( cerr );
+ // strcpy( _stack_buf, s.str().c_str() );
+}
system_error::system_error( int code, const error_category& category,
const string& what ) :
runtime_error( what ),
ecode_( code, category ),
_dbuf( 0 )
-{ }
+{
+ // stringstream s;
+ // xmt::callstack( cerr );
+ // strcpy( _stack_buf, s.str().c_str() );
+}
system_error::system_error( int code, const error_category& category ) :
runtime_error( "" ),
ecode_( code, category ),
_dbuf( 0 )
-{ }
+{
+ // stringstream s;
+ // xmt::callstack( cerr );
+ // strcpy( _stack_buf, s.str().c_str() );
+}
system_error::~system_error() throw()
{
@@ -1033,6 +1054,8 @@
size_t sz = strlen( runtime_error::what() );
size_t sz_add = sz + ecode_.message().length() + (sz > 0 ? 3 : 1); // + ": ", not \0
+ // sz_add += strlen( _stack_buf );
+
if ( sz_add < _bufsize ) {
if ( sz > 0 ) {
memcpy( _buf, runtime_error::what(), sz );
@@ -1040,6 +1063,7 @@
_buf[sz++] = ' ';
}
memcpy( _buf + sz, ecode_.message().data(), ecode_.message().length() );
+ // memcpy( _buf + sz + ecode_.message().length() + (sz > 0 ? 3 : 1), _stack_buf, strlen( _stack_buf ) );
_buf[sz_add - 1] = 0;
} else {
_dbuf = static_cast<char *>(malloc( sz_add ));
@@ -1050,6 +1074,7 @@
_dbuf[sz++] = ' ';
}
memcpy( _dbuf + sz, ecode_.message().data(), ecode_.message().length() );
+ // memcpy( _dbuf + sz + ecode_.message().length() + (sz > 0 ? 3 : 1), _stack_buf, strlen( _stack_buf ) );
_dbuf[sz_add - 1] = 0;
return _dbuf;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:34:58
|
Revision: 1971
http://complement.svn.sourceforge.net/complement/?rev=1971&view=rev
Author: complement
Date: 2008-10-13 10:34:44 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
fix test: 'all data available after sockstream was closed'
processor_core test split into four tests; in the test of 'all
data available after sockstream was closed' the key string checked
_after_ check that all worker's dtor's pass. This allow to avoid
check ambiguty.
Modified Paths:
--------------
trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
trunk/complement/explore/lib/sockios/ut/sockios2_test.h
trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:33:59 UTC (rev 1970)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.cc 2008-10-13 10:34:44 UTC (rev 1971)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/01 15:28:50 yeti>
+// -*- C++ -*- Time-stamp: <08/10/06 13:33:08 ptr>
/*
*
@@ -318,149 +318,159 @@
// prss->close();
// }
-int EXAM_IMPL(sockios2_test::processor_core)
+int EXAM_IMPL(sockios2_test::processor_core_one_local)
{
- {
- connect_processor<worker> prss( 2008 );
+ connect_processor<worker> prss( 2008 );
- EXAM_CHECK( prss.good() );
- EXAM_CHECK( prss.is_open() );
+ EXAM_CHECK( prss.good() );
+ EXAM_CHECK( prss.is_open() );
- {
- sockstream s( "localhost", 2008 );
+ {
+ sockstream s( "localhost", 2008 );
- EXAM_CHECK( s.good() );
- EXAM_CHECK( s.is_open() );
+ EXAM_CHECK( s.good() );
+ EXAM_CHECK( s.is_open() );
// for ( int i = 0; i < 64; ++i ) { // give chance to process it
// std::tr2::this_thread::yield();
// }
- unique_lock<mutex> lk( worker::lock );
+ unique_lock<mutex> lk( worker::lock );
- EXAM_CHECK( worker::cnd.timed_wait( lk, milliseconds( 500 ), worker::visits_counter1 ) );
- worker::visits = 0;
- }
+ // worker's ctor visited once:
+ EXAM_CHECK( worker::cnd.timed_wait( lk, milliseconds( 500 ), worker::visits_counter1 ) );
+ worker::visits = 0;
+ }
- // for ( int i = 0; i < 64; ++i ) { // give chance for system
- // std::tr2::this_thread::yield();
- // }
+ // for ( int i = 0; i < 64; ++i ) { // give chance for system
+ // std::tr2::this_thread::yield();
+ // }
- unique_lock<mutex> lksrv( worker::lock );
- EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
- }
+ unique_lock<mutex> lksrv( worker::lock );
+ // worker's dtor pass, no worker's objects left
+ EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
+
+ return EXAM_RESULT;
+}
+
+int EXAM_IMPL(sockios2_test::processor_core_two_local)
+{
{
+ // check precondition
lock_guard<mutex> lk( worker::lock );
EXAM_CHECK( worker::cnt == 0 );
}
- {
- connect_processor<worker> prss( 2008 );
+ connect_processor<worker> prss( 2008 );
- EXAM_CHECK( prss.good() );
- EXAM_CHECK( prss.is_open() );
+ EXAM_CHECK( prss.good() );
+ EXAM_CHECK( prss.is_open() );
- {
- sockstream s1( "localhost", 2008 );
+ {
+ sockstream s1( "localhost", 2008 );
- EXAM_CHECK( s1.good() );
- EXAM_CHECK( s1.is_open() );
+ EXAM_CHECK( s1.good() );
+ EXAM_CHECK( s1.is_open() );
- sockstream s2( "localhost", 2008 );
+ sockstream s2( "localhost", 2008 );
- EXAM_CHECK( s2.good() );
- EXAM_CHECK( s2.is_open() );
+ EXAM_CHECK( s2.good() );
+ EXAM_CHECK( s2.is_open() );
// for ( int i = 0; i < 1024; ++i ) { // give chance to process it
// std::tr2::this_thread::yield();
// }
- unique_lock<mutex> lk( worker::lock );
+ unique_lock<mutex> lk( worker::lock );
- EXAM_CHECK( worker::cnd.timed_wait( lk, milliseconds( 500 ), worker::visits_counter2 ) );
- worker::visits = 0;
- }
+ // two worker's ctors visited (two connects)
+ EXAM_CHECK( worker::cnd.timed_wait( lk, milliseconds( 500 ), worker::visits_counter2 ) );
+ worker::visits = 0;
+ }
- // for ( int i = 0; i < 64; ++i ) { // give chance for system
- // std::tr2::this_thread::yield();
- // }
- unique_lock<mutex> lksrv( worker::lock );
- EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
- }
+ // for ( int i = 0; i < 64; ++i ) { // give chance for system
+ // std::tr2::this_thread::yield();
+ // }
+ unique_lock<mutex> lksrv( worker::lock );
+ // both worker's dtors pass, no worker's objects left
+ EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
+
+ return EXAM_RESULT;
+}
+
+int EXAM_IMPL(sockios2_test::processor_core_getline)
+{
{
+ // check precondition
lock_guard<mutex> lk( worker::lock );
EXAM_CHECK( worker::cnt == 0 );
}
+ // check income data before sockstream was closed
+ connect_processor<worker> prss( 2008 );
- // check income data before sockstream was closed
+ EXAM_CHECK( prss.good() );
+ EXAM_CHECK( prss.is_open() );
+
{
- connect_processor<worker> prss( 2008 );
+ sockstream s1( "localhost", 2008 );
- EXAM_CHECK( prss.good() );
- EXAM_CHECK( prss.is_open() );
+ EXAM_CHECK( s1.good() );
+ EXAM_CHECK( s1.is_open() );
- {
- sockstream s1( "localhost", 2008 );
+ s1 << "Hello, world!" << endl;
- EXAM_CHECK( s1.good() );
- EXAM_CHECK( s1.is_open() );
+ unique_lock<mutex> lk( worker::lock );
+ EXAM_CHECK( worker::line_cnd.timed_wait( lk, milliseconds( 500 ), worker::rd_counter1 ) );
- s1 << "Hello, world!" << endl;
+ // cerr << worker::line << endl;
+ EXAM_CHECK( worker::line == "Hello, world!" );
+ worker::line = "";
+ worker::rd = 0;
+ }
- unique_lock<mutex> lk( worker::lock );
- EXAM_CHECK( worker::line_cnd.timed_wait( lk, milliseconds( 500 ), worker::rd_counter1 ) );
+ // for ( int i = 0; i < 64; ++i ) { // give chance for system
+ // std::tr2::this_thread::yield();
+ // }
- // cerr << worker::line << endl;
- EXAM_CHECK( worker::line == "Hello, world!" );
- worker::line = "";
- worker::rd = 0;
- }
+ unique_lock<mutex> lksrv( worker::lock );
+ // worker's dtor pass, no worker's objects left
+ EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
- // for ( int i = 0; i < 64; ++i ) { // give chance for system
- // std::tr2::this_thread::yield();
- // }
+ return EXAM_RESULT;
+}
- unique_lock<mutex> lksrv( worker::lock );
- EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
- }
-
+int EXAM_IMPL(sockios2_test::processor_core_income_data)
+{
// check after sockstream was closed, i.e. ensure, that all data available
- // was read before stream was closed
- {
- connect_processor<worker> prss( 2008 );
+ connect_processor<worker> prss( 2008 );
- EXAM_CHECK( prss.good() );
- EXAM_CHECK( prss.is_open() );
+ EXAM_CHECK( prss.good() );
+ EXAM_CHECK( prss.is_open() );
- {
- sockstream s1( "localhost", 2008 );
+ {
+ sockstream s1( "localhost", 2008 );
- EXAM_CHECK( s1.good() );
- EXAM_CHECK( s1.is_open() );
+ EXAM_CHECK( s1.good() );
+ EXAM_CHECK( s1.is_open() );
- s1 << "Hello, world!" << endl;
- }
+ s1 << "Hello, world!" << endl;
+ }
- {
- unique_lock<mutex> lk( worker::lock );
- EXAM_CHECK( worker::line_cnd.timed_wait( lk, milliseconds( 500 ), worker::rd_counter1 ) );
- }
+ {
+ unique_lock<mutex> lk( worker::lock );
+ EXAM_CHECK( worker::line_cnd.timed_wait( lk, milliseconds( 500 ), worker::rd_counter1 ) );
+ }
- // cerr << worker::line << endl;
- EXAM_CHECK( worker::line == "Hello, world!" );
- worker::line = "";
- worker::rd = 0;
-
- for ( int i = 0; i < 64; ++i ) { // give chance for system
- std::tr2::this_thread::yield();
- }
- // {
- // unique_lock<mutex> lksrv( worker::lock );
- // EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
- // }
+ {
+ unique_lock<mutex> lksrv( worker::lock );
+ EXAM_CHECK( worker::cnd.timed_wait( lksrv, milliseconds( 500 ), worker::counter0 ) );
}
+ EXAM_CHECK( worker::line == "Hello, world!" );
+ worker::line = "";
+ worker::rd = 0;
+
return EXAM_RESULT;
}
Modified: trunk/complement/explore/lib/sockios/ut/sockios2_test.h
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:33:59 UTC (rev 1970)
+++ trunk/complement/explore/lib/sockios/ut/sockios2_test.h 2008-10-13 10:34:44 UTC (rev 1971)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/01 12:21:46 yeti>
+// -*- C++ -*- Time-stamp: <08/10/06 13:28:39 ptr>
/*
*
@@ -23,7 +23,10 @@
int EXAM_DECL(srv_core);
int EXAM_DECL(connect_disconnect);
int EXAM_DECL(disconnect);
- int EXAM_DECL(processor_core);
+ int EXAM_DECL(processor_core_one_local);
+ int EXAM_DECL(processor_core_two_local);
+ int EXAM_DECL(processor_core_getline);
+ int EXAM_DECL(processor_core_income_data);
int EXAM_DECL(fork);
int EXAM_DECL(srv_sigpipe);
int EXAM_DECL(read0);
Modified: trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc
===================================================================
--- trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:33:59 UTC (rev 1970)
+++ trunk/complement/explore/lib/sockios/ut/sockios_test_suite.cc 2008-10-13 10:34:44 UTC (rev 1971)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/01 12:57:40 yeti>
+// -*- C++ -*- Time-stamp: <08/10/06 13:30:03 ptr>
/*
*
@@ -80,9 +80,12 @@
t.add( &sockios2_test::read0, test2, "sockios2_test::read0",
t.add( &sockios2_test::srv_sigpipe, test2, "sockios2_test::srv_sigpipe",
t.add( &sockios2_test::fork, test2, "sockios2_test::fork",
- tc[3] = t.add( &sockios2_test::processor_core, test2, "sockios2_test::processor_core",
- t.add( &sockios2_test::connect_disconnect, test2, "sockios2_test::connect_disconnect",
- t.add( &sockios2_test::srv_core, test2, "sockios2_test::srv_core" ) ) ) ) ) );
+ tc[3] = t.add( &sockios2_test::processor_core_income_data, test2, "all data available after sockstream was closed",
+ t.add( &sockios2_test::processor_core_getline, test2, "check income data before sockstream was closed",
+ t.add( &sockios2_test::processor_core_two_local, test2, "two local connects to connection processor",
+ t.add( &sockios2_test::processor_core_one_local, test2, "one local connect to connection processor",
+ t.add( &sockios2_test::connect_disconnect, test2, "sockios2_test::connect_disconnect",
+ t.add( &sockios2_test::srv_core, test2, "sockios2_test::srv_core" ) ) ) ) ) ) ) ) );
t.add( &sockios2_test::disconnect, test2, "sockios2_test::disconnect", tc[3] );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:34:09
|
Revision: 1970
http://complement.svn.sourceforge.net/complement/?rev=1970&view=rev
Author: complement
Date: 2008-10-13 10:33:59 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
use full qualification for namespace, due to possible ambiguity.
std::detail and ::detail in use, so ambiguity is possible.
Modified Paths:
--------------
trunk/complement/explore/include/sockios/sockstream
trunk/complement/explore/lib/misc/opts.cc
trunk/complement/explore/lib/mt/system_error.cc
Modified: trunk/complement/explore/include/sockios/sockstream
===================================================================
--- trunk/complement/explore/include/sockios/sockstream 2008-10-13 10:33:10 UTC (rev 1969)
+++ trunk/complement/explore/include/sockios/sockstream 2008-10-13 10:33:59 UTC (rev 1970)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/01 14:46:29 yeti>
+// -*- C++ -*- Time-stamp: <08/10/01 00:27:31 ptr>
/*
* Copyright (c) 1997-1999, 2002, 2003, 2005-2008
@@ -288,7 +288,7 @@
bool _use_wrtimeout;
bool _notify_close;
- static detail::sockmgr<charT,traits,_Alloc>* mgr;
+ static std::detail::sockmgr<charT,traits,_Alloc>* mgr;
friend class Init;
};
@@ -306,7 +306,7 @@
if ( direction ) {
std::tr2::lock_guard<std::tr2::mutex> lk( _init_lock );
if ( _count++ == 0 ) {
- basic_socket<charT,traits,_Alloc>::mgr = new detail::sockmgr<charT,traits,_Alloc>();
+ basic_socket<charT,traits,_Alloc>::mgr = new std::detail::sockmgr<charT,traits,_Alloc>();
#ifdef __FIT_PTHREADS
if ( !_at_fork ) { // call only once
if ( pthread_atfork( __at_fork_prepare, __at_fork_parent, __at_fork_child ) ) {
@@ -343,7 +343,7 @@
// stop mgr
_count = 1;
delete basic_socket<charT,traits,_Alloc>::mgr;
- basic_socket<charT,traits,_Alloc>::mgr = new detail::sockmgr<charT,traits,_Alloc>();
+ basic_socket<charT,traits,_Alloc>::mgr = new std::detail::sockmgr<charT,traits,_Alloc>();
}
// _sock_processor_base::_idx = std::tr2::this_thread::xalloc();
}
@@ -356,7 +356,7 @@
char basic_socket<charT,traits,_Alloc>::Init_buf[128];
template <class charT, class traits, class _Alloc>
-detail::sockmgr<charT,traits,_Alloc>* basic_socket<charT,traits,_Alloc>::mgr = 0;
+std::detail::sockmgr<charT,traits,_Alloc>* basic_socket<charT,traits,_Alloc>::mgr = 0;
#ifdef STLPORT
_STLP_END_NAMESPACE
@@ -620,7 +620,7 @@
std::tr2::mutex ulck;
std::tr2::condition_variable ucnd;
- friend class detail::sockmgr<charT,traits,_Alloc>;
+ friend class std::detail::sockmgr<charT,traits,_Alloc>;
friend class sock_processor_base<charT,traits,_Alloc>;
};
Modified: trunk/complement/explore/lib/misc/opts.cc
===================================================================
--- trunk/complement/explore/lib/misc/opts.cc 2008-10-13 10:33:10 UTC (rev 1969)
+++ trunk/complement/explore/lib/misc/opts.cc 2008-10-13 10:33:59 UTC (rev 1970)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/06/29 22:38:24 ptr>
+// -*- C++ -*- Time-stamp: <08/10/01 10:12:43 ptr>
/*
* Copyright (c) 2008
@@ -71,7 +71,7 @@
{
options_container_type::const_iterator i =
std::find_if( storage.begin(), storage.end(),
- std::bind2nd( detail::deref_equal<option_base*,char>(), field ) );
+ std::bind2nd( ::detail::deref_equal<option_base*,char>(), field ) );
return ( (i == storage.end()) ? false : !(*i)->pos.empty());
}
@@ -80,7 +80,7 @@
{
options_container_type::const_iterator i =
std::find_if( storage.begin(), storage.end(),
- std::bind2nd( detail::deref_equal<option_base*,std::string>(), field ) );
+ std::bind2nd( ::detail::deref_equal<option_base*,std::string>(), field ) );
return ( (i == storage.end()) ? false : !(*i)->pos.empty());
}
@@ -89,7 +89,7 @@
{
options_container_type::const_iterator i =
std::find_if( storage.begin(), storage.end(),
- std::bind2nd( detail::deref_equal<option_base*,int>(), field ) );
+ std::bind2nd( ::detail::deref_equal<option_base*,int>(), field ) );
return ( (i == storage.end()) ? false : !(*i)->pos.empty());
}
@@ -98,7 +98,7 @@
{
options_container_type::const_iterator i =
std::find_if( storage.begin(), storage.end(),
- std::bind2nd( detail::deref_equal<option_base*,char>(), field ) );
+ std::bind2nd( ::detail::deref_equal<option_base*,char>(), field ) );
return ( (i == storage.end()) ? 0 : (*i)->pos.size());
}
@@ -107,7 +107,7 @@
{
options_container_type::const_iterator i =
std::find_if( storage.begin(), storage.end(),
- std::bind2nd( detail::deref_equal<option_base*,std::string>(), field ) );
+ std::bind2nd( ::detail::deref_equal<option_base*,std::string>(), field ) );
return ( (i == storage.end()) ? 0 : (*i)->pos.size());
}
@@ -116,7 +116,7 @@
{
options_container_type::const_iterator i =
std::find_if( storage.begin(), storage.end(),
- std::bind2nd( detail::deref_equal<option_base*,int>(), field ) );
+ std::bind2nd( ::detail::deref_equal<option_base*,int>(), field ) );
return ( (i == storage.end()) ? 0 : (*i)->pos.size());
}
Modified: trunk/complement/explore/lib/mt/system_error.cc
===================================================================
--- trunk/complement/explore/lib/mt/system_error.cc 2008-10-13 10:33:10 UTC (rev 1969)
+++ trunk/complement/explore/lib/mt/system_error.cc 2008-10-13 10:33:59 UTC (rev 1970)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/25 10:04:45 ptr>
+// -*- C++ -*- Time-stamp: <08/10/01 00:22:12 ptr>
/*
* Copyright (c) 2007-2008
@@ -900,17 +900,17 @@
const error_category& get_posix_category()
{
- return detail::_posix_error_category;
+ return ::detail::_posix_error_category;
}
const error_category& get_system_category()
{
- return detail::_system_error_category;
+ return ::detail::_system_error_category;
}
error_code::error_code() :
v( 0 ),
- c( &detail::_system_error_category )
+ c( &::detail::_system_error_category )
{ }
error_code::error_code( int val, const error_category& cat ) :
@@ -927,16 +927,16 @@
void error_code::clear()
{
v = 0;
- c = &detail::_system_error_category;
+ c = &::detail::_system_error_category;
}
namespace posix_error {
error_code make_error_code( posix_errno err )
-{ return error_code( err, detail::_posix_error_category ); }
+{ return error_code( err, ::detail::_posix_error_category ); }
error_condition make_error_condition( posix_errno err )
-{ return error_condition( err, detail::_posix_error_category ); }
+{ return error_condition( err, ::detail::_posix_error_category ); }
} // namespace posix_error
@@ -947,7 +947,7 @@
error_condition::error_condition() :
v( 0 ),
- c( &detail::_posix_error_category )
+ c( &::detail::_posix_error_category )
{ }
error_condition::error_condition( int val, const error_category& cat ) :
@@ -964,7 +964,7 @@
void error_condition::clear()
{
v = 0;
- c = &detail::_posix_error_category;
+ c = &::detail::_posix_error_category;
}
bool operator <( const error_condition& l, const error_condition& r )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-10-13 10:33:16
|
Revision: 1969
http://complement.svn.sourceforge.net/complement/?rev=1969&view=rev
Author: complement
Date: 2008-10-13 10:33:10 +0000 (Mon, 13 Oct 2008)
Log Message:
-----------
attempt to test presence of some ctor in class
really I can't do this: impossible take address of ctor
Modified Paths:
--------------
trunk/complement/explore/lib/misc/ut/misc_test.cc
trunk/complement/explore/lib/misc/ut/misc_test.h
Modified: trunk/complement/explore/lib/misc/ut/misc_test.cc
===================================================================
--- trunk/complement/explore/lib/misc/ut/misc_test.cc 2008-09-10 06:18:29 UTC (rev 1968)
+++ trunk/complement/explore/lib/misc/ut/misc_test.cc 2008-10-13 10:33:10 UTC (rev 1969)
@@ -580,3 +580,44 @@
return EXAM_RESULT;
}
+struct X
+{
+};
+
+struct Y
+{
+ Y()
+ { }
+ Y( const X& )
+ { }
+};
+
+template <class T>
+struct __ctor_aux : // union or class
+ public std::tr1::detail::__select_types
+{
+ private:
+ template <class _Up>
+ static __t1 __test( int (_Up::*)() );
+
+ template <class>
+ static __t2 __test(...);
+
+ public:
+#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION
+ static const bool __value;
+#else
+ static const bool __value = sizeof(__test<T>(0)) == sizeof(std::tr1::detail::__select_types::__t1);
+#endif
+};
+
+#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION
+template <class T>
+const bool __ctor_aux<T>::__value = sizeof(__ctor_aux<T>::__test<T>(0)) == sizeof(std::tr1::detail::__select_types::__t1);
+#endif
+
+int EXAM_IMPL(type_traits_has_x_ctor)
+{
+ return EXAM_RESULT;
+}
+
Modified: trunk/complement/explore/lib/misc/ut/misc_test.h
===================================================================
--- trunk/complement/explore/lib/misc/ut/misc_test.h 2008-09-10 06:18:29 UTC (rev 1968)
+++ trunk/complement/explore/lib/misc/ut/misc_test.h 2008-10-13 10:33:10 UTC (rev 1969)
@@ -1,7 +1,7 @@
// -*- C++ -*- Time-stamp: <08/06/30 12:40:05 yeti>
/*
- * Copyright (c) 2007
+ * Copyright (c) 2007, 2008
* Petr Ovtchenkov
*
* Licensed under the Academic Free License Version 3.0
@@ -52,6 +52,9 @@
int EXAM_DECL(type_traits_is_pod);
int EXAM_DECL(type_traits_is_pod_compiler_supp);
int EXAM_DECL(type_traits_is_empty);
+
+ // aux
+ int EXAM_DECL(type_traits_has_x_ctor);
};
#endif // __MISC_TEST_H
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-10 06:18:31
|
Revision: 1968
http://complement.svn.sourceforge.net/complement/?rev=1968&view=rev
Author: complement
Date: 2008-09-10 06:18:29 +0000 (Wed, 10 Sep 2008)
Log Message:
-----------
replace is_reference by is_lvalue_reference
Modified Paths:
--------------
trunk/complement/explore/include/misc/type_traits.h
Modified: trunk/complement/explore/include/misc/type_traits.h
===================================================================
--- trunk/complement/explore/include/misc/type_traits.h 2008-09-09 06:28:34 UTC (rev 1967)
+++ trunk/complement/explore/include/misc/type_traits.h 2008-09-10 06:18:29 UTC (rev 1968)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/09/09 10:22:13 ptr>
+// -*- C++ -*- Time-stamp: <08/09/10 09:50:18 ptr>
/*
* Copyright (c) 2007, 2008
@@ -277,21 +277,21 @@
// public true_type
// { };
-template <class _Tp>
-struct is_reference :
- public false_type
-{ };
+// template <class _Tp>
+// struct is_reference :
+// public false_type
+// { };
-template <class _Tp>
-struct is_reference<_Tp&> :
- public true_type
-{ };
+// template <class _Tp>
+// struct is_reference<_Tp&> :
+// public true_type
+// { };
template <class _Tp>
struct is_function :
public integral_constant<bool, !(detail::__instance<_Tp>::__value
|| detail::__is_union_or_class<_Tp>::value
- || is_reference<_Tp>::value
+ || is_lvalue_reference<_Tp>::value
|| is_void<_Tp>::value)>
{ };
@@ -375,7 +375,7 @@
public integral_constant<bool, !(is_fundamental<_Tp>::value
|| is_array<_Tp>::value
|| is_pointer<_Tp>::value
- || is_reference<_Tp>::value
+ || is_lvalue_reference<_Tp>::value
|| is_member_pointer<_Tp>::value
|| is_function<_Tp>::value
|| detail::__is_union_or_class<_Tp>::value) >
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-09 06:28:39
|
Revision: 1967
http://complement.svn.sourceforge.net/complement/?rev=1967&view=rev
Author: complement
Date: 2008-09-09 06:28:34 +0000 (Tue, 09 Sep 2008)
Log Message:
-----------
add make_signed/make_unsigned; replace add_reference by lvalue/rvalue
Close to [http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2723.pdf]
syntax.
Modified Paths:
--------------
trunk/complement/explore/include/misc/type_traits.h
Modified: trunk/complement/explore/include/misc/type_traits.h
===================================================================
--- trunk/complement/explore/include/misc/type_traits.h 2008-09-08 19:58:50 UTC (rev 1966)
+++ trunk/complement/explore/include/misc/type_traits.h 2008-09-09 06:28:34 UTC (rev 1967)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/20 18:17:36 ptr>
+// -*- C++ -*- Time-stamp: <08/09/09 10:22:13 ptr>
/*
* Copyright (c) 2007, 2008
@@ -6,6 +6,8 @@
*
* Licensed under the Academic Free License version 3.0
*
+ * Should be close to JTC1/SC22/WG21 C++ 0x working draft
+ * [http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2723.pdf]
*/
#ifndef __misc_type_traits_h
@@ -193,7 +195,7 @@
__SPEC_2(C,T volatile,B); \
__SPEC_2(C,T const volatile,B)
-// [4.5.1] primary type categories:
+// [20.5.4.1] primary type categories:
template <class _Tp>
struct is_void :
@@ -352,8 +354,10 @@
public integral_constant<bool, (is_member_object_pointer<_Tp>::value || is_member_function_pointer<_Tp>::value)>
{ };
-// 4.5.2 composite type categories
+// [20.5.4.2] composite type categories
+// is_reference see above
+
template <class _Tp>
struct is_arithmetic :
public integral_constant<bool, (is_integral<_Tp>::value || is_floating_point<_Tp>::value)>
@@ -364,7 +368,7 @@
public integral_constant<bool, (is_arithmetic<_Tp>::value || is_void<_Tp>::value)>
{ };
-// [4.5.1] primary type categories (continued):
+// [20.5.4.1] primary type categories (continued):
template <class _Tp>
struct is_enum :
@@ -387,7 +391,7 @@
// is_function (above)
-// 4.5.2 composite type categories (continued)
+// [20.5.4.2] composite type categories (continued)
// is_arithmetic (above)
// is_fundamental (above)
@@ -416,7 +420,7 @@
// is_member_pointer
-// 4.5.3 type properties:
+// [20.5.4.3] type properties:
template <class _Tp>
struct is_const :
@@ -439,7 +443,7 @@
{ };
-// 4.7.3 array modifications:
+// [20.5.6.4] array modifications:
template <class _Tp>
struct remove_extent
@@ -477,7 +481,7 @@
typedef typename remove_all_extents<_Tp>::type type;
};
-// 4.5.3 type properties (continued):
+// [20.5.4.3] type properties (continued):
template <class _Tp>
struct is_trivial :
@@ -507,12 +511,12 @@
// is_abstract
template <class _Tp>
-struct has_trivial_constructor :
+struct has_trivial_default_constructor :
public integral_constant<bool, is_pod<_Tp>::value>
{ };
template <class _Tp>
-struct has_trivial_copy :
+struct has_trivial_copy_constructor :
public integral_constant<bool, is_pod<_Tp>::value>
{ };
@@ -527,12 +531,12 @@
{ };
template <class _Tp>
-struct has_nothrow_constructor :
+struct has_nothrow_default_constructor :
public integral_constant<bool, is_pod<_Tp>::value>
{ };
template <class _Tp>
-struct has_nothrow_copy :
+struct has_nothrow_copy_constructor :
public integral_constant<bool, is_pod<_Tp>::value>
{ };
@@ -572,7 +576,7 @@
// rank
// extent
-// 4.6 type relations:
+// [20.5.5] type relations:
template <class _Tp1, class _Tp2>
struct is_same :
@@ -587,7 +591,7 @@
// is_base_of
// is_convertible
-// 4.7.1 const-volatile modifications
+// [20.5.6.1] const-volatile modifications
template <class _Tp>
struct remove_const
@@ -624,20 +628,32 @@
{
typedef _Tp const type;
};
-
+
template <class _Tp>
+struct add_const<_Tp const>
+{
+ typedef _Tp const type;
+};
+
+template <class _Tp>
struct add_volatile
{
typedef _Tp volatile type;
};
template <class _Tp>
+struct add_volatile<_Tp volatile>
+{
+ typedef _Tp volatile type;
+};
+
+template <class _Tp>
struct add_cv
{
typedef typename add_const<typename add_volatile<_Tp>::type>::type type;
};
-// 4.7.2 reference modifications:
+// [20.5.6.2] reference modifications:
template <class _Tp>
struct remove_reference
@@ -651,23 +667,185 @@
typedef _Tp type;
};
+// template <class _Tp>
+// struct remove_reference<_Tp&&>
+// {
+// typedef _Tp type;
+// };
+
template <class _Tp>
-struct add_reference
+struct add_lvalue_reference
{
typedef _Tp& type;
};
template <class _Tp>
-struct add_reference<_Tp&>
+struct add_lvalue_reference<_Tp&>
{
typedef _Tp& type;
};
+
+// template <class _Tp>
+// struct add_rvalue_reference
+// {
+// typedef _Tp&& type;
+// };
-// 4.7.3 array modifications (see above)
+// template <class _Tp>
+// struct add_rvalue_reference<_Tp&&>
+// {
+// typedef _Tp&& type;
+// };
-// 4.7.4 pointer modifications:
+// [20.5.6.3] sign modifications
template <class _Tp>
+struct make_signed
+{
+};
+
+template <>
+struct make_signed<char>
+{
+ typedef signed char type;
+};
+
+template <>
+struct make_signed<signed char>
+{
+ typedef signed char type;
+};
+
+template <>
+struct make_signed<unsigned char>
+{
+ typedef signed char type;
+};
+
+template <>
+struct make_signed<short>
+{
+ typedef short type;
+};
+
+template <>
+struct make_signed<unsigned short>
+{
+ typedef short type;
+};
+
+template <>
+struct make_signed<int>
+{
+ typedef int type;
+};
+
+template <>
+struct make_signed<unsigned int>
+{
+ typedef int type;
+};
+
+template <>
+struct make_signed<long>
+{
+ typedef long type;
+};
+
+template <>
+struct make_signed<unsigned long>
+{
+ typedef long type;
+};
+
+template <>
+struct make_signed<long long>
+{
+ typedef long long type;
+};
+
+template <>
+struct make_signed<unsigned long long>
+{
+ typedef long long type;
+};
+
+template <class _Tp>
+struct make_unsigned
+{
+};
+
+template <>
+struct make_unsigned<char>
+{
+ typedef unsigned char type;
+};
+
+template <>
+struct make_unsigned<signed char>
+{
+ typedef unsigned char type;
+};
+
+template <>
+struct make_unsigned<unsigned char>
+{
+ typedef unsigned char type;
+};
+
+template <>
+struct make_unsigned<short>
+{
+ typedef unsigned short type;
+};
+
+template <>
+struct make_unsigned<unsigned short>
+{
+ typedef unsigned short type;
+};
+
+template <>
+struct make_unsigned<int>
+{
+ typedef unsigned int type;
+};
+
+template <>
+struct make_unsigned<unsigned int>
+{
+ typedef unsigned int type;
+};
+
+template <>
+struct make_unsigned<long>
+{
+ typedef unsigned long type;
+};
+
+template <>
+struct make_unsigned<unsigned long>
+{
+ typedef unsigned long type;
+};
+
+template <>
+struct make_unsigned<long long>
+{
+ typedef unsigned long long type;
+};
+
+template <>
+struct make_unsigned<unsigned long long>
+{
+ typedef unsigned long long type;
+};
+
+// [20.5.6.4] array modifications (see above)
+
+// [20.5.6.5] pointer modifications:
+
+template <class _Tp>
struct remove_pointer
{
typedef _Tp type;
@@ -703,9 +881,10 @@
typedef typename remove_reference<_Tp>::type * type;
};
-// 4.8 other transformations:
+// [20.5.7] other transformations:
-// aligned_storage
+// template <std::size_t Len, std::size_t Align> struct aligned_storage;
+// template <std::size_t Len, class... Types> struct aligned_union;
namespace detail {
@@ -768,6 +947,8 @@
typedef _Tp1 type;
};
+// template <class... _Tp> struct common_type;
+
#undef __CV_SPEC
#undef __SPEC_
#undef __CV_SPEC_1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-08 19:59:01
|
Revision: 1966
http://complement.svn.sourceforge.net/complement/?rev=1966&view=rev
Author: complement
Date: 2008-09-08 19:58:50 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
use only one definition of hash<void*>
When compile without STLport bu gcc before 4.x, hash<void*>
should be defined, but only once.
Modified Paths:
--------------
trunk/complement/explore/include/sockios/sockmgr.h
trunk/complement/explore/include/stem/Event.h
Modified: trunk/complement/explore/include/sockios/sockmgr.h
===================================================================
--- trunk/complement/explore/include/sockios/sockmgr.h 2008-09-08 19:57:49 UTC (rev 1965)
+++ trunk/complement/explore/include/sockios/sockmgr.h 2008-09-08 19:58:50 UTC (rev 1966)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/06/27 00:50:33 ptr>
+// -*- C++ -*- Time-stamp: <08/09/08 23:18:28 ptr>
/*
* Copyright (c) 2008
@@ -319,13 +319,16 @@
}
#endif
-#if defined(__GNUC__) && (__GNUC__ < 4)
+#if defined(__GNUC__) && (__GNUC__ < 4) && !defined(HASH_VOID_PTR_DEFINED)
template<>
struct hash<void *>
{
size_t operator()(const void *__x) const
{ return reinterpret_cast<size_t>(__x); }
};
+
+#define HASH_VOID_PTR_DEFINED
+
#endif // __GNUC__ < 4
} // namespace __HASH_NAMESPACE
Modified: trunk/complement/explore/include/stem/Event.h
===================================================================
--- trunk/complement/explore/include/stem/Event.h 2008-09-08 19:57:49 UTC (rev 1965)
+++ trunk/complement/explore/include/stem/Event.h 2008-09-08 19:58:50 UTC (rev 1966)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/06/30 18:14:16 yeti>
+// -*- C++ -*- Time-stamp: <08/09/08 23:18:05 ptr>
/*
*
@@ -664,13 +664,16 @@
}
#endif
-#if defined(__GNUC__) && (__GNUC__ < 4)
+#if defined(__GNUC__) && (__GNUC__ < 4) && !defined(HASH_VOID_PTR_DEFINED)
template<>
struct hash<void *>
{
size_t operator()(const void *__x) const
{ return reinterpret_cast<size_t>(__x); }
};
+
+#define HASH_VOID_PTR_DEFINED
+
#endif // __GNUC__ < 4
} // namespace __HASH_NAMESPACE
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-08 19:57:51
|
Revision: 1965
http://complement.svn.sourceforge.net/complement/?rev=1965&view=rev
Author: complement
Date: 2008-09-08 19:57:49 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
add const to some auxilary functions; libmisc version 1.10.2
Modified Paths:
--------------
trunk/complement/explore/include/misc/opts.h
trunk/complement/explore/lib/misc/ChangeLog
trunk/complement/explore/lib/misc/Makefile.inc
trunk/complement/explore/lib/misc/opts.cc
Modified: trunk/complement/explore/include/misc/opts.h
===================================================================
--- trunk/complement/explore/include/misc/opts.h 2008-09-08 19:56:25 UTC (rev 1964)
+++ trunk/complement/explore/include/misc/opts.h 2008-09-08 19:57:49 UTC (rev 1965)
@@ -469,8 +469,8 @@
bool isterm( const std::string& s );
bool is_opt_name( const std::string& s );
bool is_flag_group( const std::string& s );
- bool is_substr(const std::string& small, const std::string& big );
- options_container_type::const_iterator get_opt_index( const std::string& s );
+ bool is_substr(const std::string& small, const std::string& big ) const;
+ options_container_type::const_iterator get_opt_index( const std::string& s ) const;
};
template < class T , class V >
Modified: trunk/complement/explore/lib/misc/ChangeLog
===================================================================
--- trunk/complement/explore/lib/misc/ChangeLog 2008-09-08 19:56:25 UTC (rev 1964)
+++ trunk/complement/explore/lib/misc/ChangeLog 2008-09-08 19:57:49 UTC (rev 1965)
@@ -1,8 +1,12 @@
2008-09-08 Petr Ovtchenkov <pt...@vo...>
* type_traits.h: add enable_if, conditional and decay;
- useful when no STLport and gcc before 4.x.
+ useful when no STLport and gcc before 4.x;
+ * opts.h, opts.cc: add const to some auxilary functions;
+
+ * libmisc: version 1.10.2.
+
2008-07-21 Petr Ovtchenkov <pt...@is...>
* type_traits.h: fix STLport version; use type_traits
Modified: trunk/complement/explore/lib/misc/Makefile.inc
===================================================================
--- trunk/complement/explore/lib/misc/Makefile.inc 2008-09-08 19:56:25 UTC (rev 1964)
+++ trunk/complement/explore/lib/misc/Makefile.inc 2008-09-08 19:57:49 UTC (rev 1965)
@@ -1,4 +1,4 @@
-# -*- Makefile -*- Time-stamp: <08/06/30 10:25:33 ptr>
+# -*- Makefile -*- Time-stamp: <08/09/08 23:48:21 ptr>
# I have only one reason while I should use "C++" variant of MD5 instead of "C":
# names like MD5Init is wide distributed, but some cool programmers use this
@@ -10,6 +10,6 @@
LIBNAME = misc
MAJOR = 1
MINOR = 10
-PATCH = 1
+PATCH = 2
SRC_CC = CyrMoney.cc args.cc arguments.cc opts.cc
SRC_C = md5.c
Modified: trunk/complement/explore/lib/misc/opts.cc
===================================================================
--- trunk/complement/explore/lib/misc/opts.cc 2008-09-08 19:56:25 UTC (rev 1964)
+++ trunk/complement/explore/lib/misc/opts.cc 2008-09-08 19:57:49 UTC (rev 1965)
@@ -128,13 +128,19 @@
return (s.size() > 1) && (s[0] == '-') && !is_flag_group(s);
}
-bool Opts::is_substr(const string& small,const string& big)
+bool Opts::is_substr( const string& small, const string& big ) const
{
- if (small.size() > big.size())
+ if ( small.size() > big.size() ) {
return false;
- for (int i = 0;i < small.size();i++)
- if (small[i] != big[i])
+ }
+
+ string::const_iterator i = small.begin();
+ string::const_iterator j = big.begin();
+ for ( ; i != small.end(); ++i, ++j ) {
+ if ( *i != *j ) {
return false;
+ }
+ }
return true;
}
@@ -155,9 +161,9 @@
}
// this function assumes that is_opt_name(s) = true;
-Opts::options_container_type::const_iterator Opts::get_opt_index( const string& s)
+Opts::options_container_type::const_iterator Opts::get_opt_index( const string& s) const
{
- assert(is_opt_name(s));
+ // assert(is_opt_name(s));
if (s.size() == 2 && isalnum(s[1]) ) { // is short name
options_container_type::const_iterator i = storage.begin();
for ( ; i != storage.end(); ++i ) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-08 19:56:33
|
Revision: 1964
http://complement.svn.sourceforge.net/complement/?rev=1964&view=rev
Author: complement
Date: 2008-09-08 19:56:25 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
libxmt revision 2.0.10
gcc 3.3.6 has a problem with friend templates.
Revision Links:
--------------
http://complement.svn.sourceforge.net/complement/?rev=2&view=rev
Modified Paths:
--------------
trunk/complement/explore/include/mt/mutex
trunk/complement/explore/lib/mt/ChangeLog
trunk/complement/explore/lib/mt/Makefile.inc
Modified: trunk/complement/explore/include/mt/mutex
===================================================================
--- trunk/complement/explore/include/mt/mutex 2008-09-08 19:55:28 UTC (rev 1963)
+++ trunk/complement/explore/include/mt/mutex 2008-09-08 19:56:25 UTC (rev 1964)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/30 19:44:33 ptr>
+// -*- C++ -*- Time-stamp: <08/09/08 23:26:16 ptr>
/*
* Copyright (c) 1997-1999, 2002-2008
@@ -778,7 +778,13 @@
unique_lock& operator =( const unique_lock& )
{ return *this; }
+#if defined(__GNUC__) && (__GNUC__ < 4)
+ public:
+#endif
const M* m;
+#if defined(__GNUC__) && (__GNUC__ < 4)
+ private:
+#endif
bool lk;
friend class __condition_variable<true>;
friend class __condition_variable<false>;
Modified: trunk/complement/explore/lib/mt/ChangeLog
===================================================================
--- trunk/complement/explore/lib/mt/ChangeLog 2008-09-08 19:55:28 UTC (rev 1963)
+++ trunk/complement/explore/lib/mt/ChangeLog 2008-09-08 19:56:25 UTC (rev 1964)
@@ -1,8 +1,12 @@
2008-09-08 Petr Ovtchenkov <pt...@vo...>
* system_error: use misc/type_traits.h for gcc before 4.x and
- without STLport.
+ without STLport;
+ * mutex: gcc 3.3.6 has a problem with friend templates;
+
+ * libxmt: bump revision to 2.0.10.
+
2008-07-30 Petr Ovtchenkov <pt...@is...>
* condition_variable: throw system_error when problem detected;
Modified: trunk/complement/explore/lib/mt/Makefile.inc
===================================================================
--- trunk/complement/explore/lib/mt/Makefile.inc 2008-09-08 19:55:28 UTC (rev 1963)
+++ trunk/complement/explore/lib/mt/Makefile.inc 2008-09-08 19:56:25 UTC (rev 1964)
@@ -1,9 +1,9 @@
-# -*- Makefile -*- Time-stamp: <08/07/30 19:12:30 ptr>
+# -*- Makefile -*- Time-stamp: <08/09/08 23:45:46 ptr>
LIBNAME = xmt
MAJOR = 2
MINOR = 0
-PATCH = 9
+PATCH = 10
SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc shm.cc callstack.cc system_error.cc thread.cc \
date_time.cc
SRC_C = fl.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-08 19:55:30
|
Revision: 1963
http://complement.svn.sourceforge.net/complement/?rev=1963&view=rev
Author: complement
Date: 2008-09-08 19:55:28 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
use misc/type_traits.h for gcc before 4.x and without STLport
Modified Paths:
--------------
trunk/complement/explore/include/mt/system_error
trunk/complement/explore/lib/mt/ChangeLog
Modified: trunk/complement/explore/include/mt/system_error
===================================================================
--- trunk/complement/explore/include/mt/system_error 2008-09-08 19:54:51 UTC (rev 1962)
+++ trunk/complement/explore/include/mt/system_error 2008-09-08 19:55:28 UTC (rev 1963)
@@ -19,9 +19,12 @@
#include <stdexcept>
#ifdef STLPORT
-#include <type_traits>
+# include <type_traits>
#else
-#include <tr1/type_traits>
+# if defined(__GNUC__) && (__GNUC__ < 4)
+# include <misc/type_traits.h>
+# else
+# include <tr1/type_traits>
namespace std {
@@ -92,6 +95,8 @@
} // namesapce std
+# endif // gcc after 3.x
+
#endif
#include <cerrno>
Modified: trunk/complement/explore/lib/mt/ChangeLog
===================================================================
--- trunk/complement/explore/lib/mt/ChangeLog 2008-09-08 19:54:51 UTC (rev 1962)
+++ trunk/complement/explore/lib/mt/ChangeLog 2008-09-08 19:55:28 UTC (rev 1963)
@@ -1,3 +1,8 @@
+2008-09-08 Petr Ovtchenkov <pt...@vo...>
+
+ * system_error: use misc/type_traits.h for gcc before 4.x and
+ without STLport.
+
2008-07-30 Petr Ovtchenkov <pt...@is...>
* condition_variable: throw system_error when problem detected;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-08 19:54:53
|
Revision: 1962
http://complement.svn.sourceforge.net/complement/?rev=1962&view=rev
Author: complement
Date: 2008-09-08 19:54:51 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
add enable_if, conditional and decay
Use some things that I made for STLport; useful when no STLport
and gcc before 4.x.
Modified Paths:
--------------
trunk/complement/explore/include/misc/type_traits.h
trunk/complement/explore/lib/misc/ChangeLog
Modified: trunk/complement/explore/include/misc/type_traits.h
===================================================================
--- trunk/complement/explore/include/misc/type_traits.h 2008-09-08 19:54:20 UTC (rev 1961)
+++ trunk/complement/explore/include/misc/type_traits.h 2008-09-08 19:54:51 UTC (rev 1962)
@@ -707,6 +707,67 @@
// aligned_storage
+namespace detail {
+
+template <bool,class _U>
+struct _decay_aux2
+{
+ typedef typename remove_cv<_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux2<true,_U>
+{
+ typedef typename add_pointer<_U>::type type;
+};
+
+template <bool, class _U>
+struct _decay_aux1
+{
+ typedef typename _decay_aux2<is_function<_U>::value,_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux1<true,_U>
+{
+ typedef typename remove_extent<_U>::type* type;
+};
+
+} // namespace detail
+
+template <class _Tp>
+class decay
+{
+ private:
+ typedef typename remove_reference<_Tp>::type _U;
+
+ public:
+ typedef typename detail::_decay_aux1<is_array<_U>::value,_U>::type type;
+};
+
+template <bool, class _Tp = void>
+struct enable_if
+{
+};
+
+template <class _Tp>
+struct enable_if<true,_Tp>
+{
+ typedef _Tp type;
+};
+
+template <bool, class _Tp1, class _Tp2>
+struct conditional
+{
+ typedef _Tp2 type;
+};
+
+template <class _Tp1, class _Tp2>
+struct conditional<true,_Tp1,_Tp2>
+{
+ typedef _Tp1 type;
+};
+
#undef __CV_SPEC
#undef __SPEC_
#undef __CV_SPEC_1
Modified: trunk/complement/explore/lib/misc/ChangeLog
===================================================================
--- trunk/complement/explore/lib/misc/ChangeLog 2008-09-08 19:54:20 UTC (rev 1961)
+++ trunk/complement/explore/lib/misc/ChangeLog 2008-09-08 19:54:51 UTC (rev 1962)
@@ -1,3 +1,8 @@
+2008-09-08 Petr Ovtchenkov <pt...@vo...>
+
+ * type_traits.h: add enable_if, conditional and decay;
+ useful when no STLport and gcc before 4.x.
+
2008-07-21 Petr Ovtchenkov <pt...@is...>
* type_traits.h: fix STLport version; use type_traits
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-09-08 19:54:25
|
Revision: 1961
http://complement.svn.sourceforge.net/complement/?rev=1961&view=rev
Author: complement
Date: 2008-09-08 19:54:20 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
corrected check of settings for builds without STLport
macro WITHOUT_STLPORT may be defined in gmake/extern.mak, if no
STLport macro detected; check and set macro that depends upon
WITHOUT_STLPORT (if it present) after gmake/extern.mak was included.
Modified Paths:
--------------
trunk/complement/explore/Makefiles/ChangeLog
trunk/complement/explore/Makefiles/gmake/top.mak
Modified: trunk/complement/explore/Makefiles/ChangeLog
===================================================================
--- trunk/complement/explore/Makefiles/ChangeLog 2008-08-14 18:25:31 UTC (rev 1960)
+++ trunk/complement/explore/Makefiles/ChangeLog 2008-09-08 19:54:20 UTC (rev 1961)
@@ -1,3 +1,8 @@
+2008-09-08 Petr Ovtchenkov <pt...@vo...>
+
+ * gmake/top.mak: corrected check of settings for builds
+ without STLport.
+
2008-06-16 Petr Ovtchenkov <pt...@is...>
* gmake/subdirs.mak: function to pass tag for make in
Modified: trunk/complement/explore/Makefiles/gmake/top.mak
===================================================================
--- trunk/complement/explore/Makefiles/gmake/top.mak 2008-08-14 18:25:31 UTC (rev 1960)
+++ trunk/complement/explore/Makefiles/gmake/top.mak 2008-09-08 19:54:20 UTC (rev 1961)
@@ -50,6 +50,25 @@
endif
endif
+endif
+
+all: $(OUTPUT_DIRS) $(ALL_TAGS)
+
+ifndef OSNAME
+# identify OS and build date
+include ${RULESBASE}/gmake/sysid.mak
+endif
+# OS-specific definitions, like ln, install, etc. (guest host)
+include ${RULESBASE}/gmake/$(BUILD_OSNAME)/sys.mak
+# target OS-specific definitions, like ar, etc.
+include ${RULESBASE}/gmake/$(OSNAME)/targetsys.mak
+# Extern projects for everyday usage and settings for ones
+include ${RULESBASE}/gmake/extern.mak
+
+ifdef WITHOUT_STLPORT
+NOT_USE_NOSTDLIB := 1
+endif
+
ifndef _NO_STLDBG_BUILD
ifndef WITHOUT_STLPORT
ifndef _NO_SHARED_BUILD
@@ -61,32 +80,14 @@
endif
endif
-endif
-
-all: $(OUTPUT_DIRS) $(ALL_TAGS)
-
ifndef WITHOUT_STLPORT
-all-static: release-static dbg-static stldbg-static
-all-shared: release-shared dbg-shared stldbg-shared
+all-static: release-static dbg-static stldbg-static
+all-shared: release-shared dbg-shared stldbg-shared
else
-all-static: release-static dbg-static
-all-shared: release-shared dbg-shared
+all-static: release-static dbg-static
+all-shared: release-shared dbg-shared
endif
-ifdef WITHOUT_STLPORT
-NOT_USE_NOSTDLIB := 1
-endif
-
-ifndef OSNAME
-# identify OS and build date
-include ${RULESBASE}/gmake/sysid.mak
-endif
-# OS-specific definitions, like ln, install, etc. (guest host)
-include ${RULESBASE}/gmake/$(BUILD_OSNAME)/sys.mak
-# target OS-specific definitions, like ar, etc.
-include ${RULESBASE}/gmake/$(OSNAME)/targetsys.mak
-# Extern projects for everyday usage and settings for ones
-include ${RULESBASE}/gmake/extern.mak
# compiler, compiler options
include ${RULESBASE}/gmake/$(COMPILER_NAME).mak
# rules to make dirs for targets
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-08-14 18:25:34
|
Revision: 1960
http://complement.svn.sourceforge.net/complement/?rev=1960&view=rev
Author: complement
Date: 2008-08-14 18:25:31 +0000 (Thu, 14 Aug 2008)
Log Message:
-----------
BDB, test for C
Modified Paths:
--------------
trunk/complement/explore/perf/DB/Berkeley/Makefile
trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc
trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h
trunk/complement/explore/perf/DB/Berkeley/suite.cc
Modified: trunk/complement/explore/perf/DB/Berkeley/Makefile
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/Makefile 2008-08-13 16:27:09 UTC (rev 1959)
+++ trunk/complement/explore/perf/DB/Berkeley/Makefile 2008-08-14 18:25:31 UTC (rev 1960)
@@ -1,4 +1,4 @@
-# -*- Makefile -*- Time-stamp: <08/07/31 15:43:19 yeti>
+# -*- Makefile -*- Time-stamp: <08/08/14 21:19:55 yeti>
SRCROOT := ../../..
Modified: trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc 2008-08-13 16:27:09 UTC (rev 1959)
+++ trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc 2008-08-14 18:25:31 UTC (rev 1960)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/13 13:28:22 yeti>
+// -*- C++ -*- Time-stamp: <08/08/14 21:19:44 yeti>
/*
* Copyright (c) 2008
@@ -13,6 +13,7 @@
#include <mt/thread>
#include <mt/mutex>
+#include <db.h>
#include <db_cxx.h>
#include <sys/stat.h>
@@ -20,6 +21,70 @@
int EXAM_IMPL(sleepycat_test::hash_open)
{
+ DB *DBref;
+ DB_ENV *DBenv;
+
+ int err = db_env_create( &DBenv, 0 );
+
+ if ( err ) {
+ return 1;
+ }
+
+ const char logDir[] = "./DB_logs";
+
+ mkdir( logDir, 0777 );
+
+ // DBenv->set_tmp_dir( DBenv, logDir );
+ DBenv->set_lg_dir( DBenv, logDir );
+ DBenv->set_flags( DBenv, DB_AUTO_COMMIT | DB_LOG_INMEMORY | DB_LOG_AUTOREMOVE, 1 );
+
+ err = DBenv->open( DBenv, ".", DB_INIT_TXN | DB_INIT_LOG | DB_INIT_MPOOL | DB_CREATE, 0 );
+
+ if ( err ) {
+ return 1;
+ }
+
+ err = db_create( &DBref, DBenv, 0 );
+
+ if ( err ) {
+ return 1;
+ }
+
+ // This should suffice for most users.
+
+ DBref->set_h_nelem( DBref, 30 );
+
+ // The BDB documentation says the fill factor should be
+ // (pagesize - 32) / (average_key_size + average_data_size + 8);
+ // For labels, average key size = sizeof(TId) = 16, average data size = 0,
+ // supposing 4K pages this gives us 169 1/3 for the fill factor.
+
+ DBref->set_h_ffactor( DBref, 150 );
+
+ err = DBref->open( DBref, 0, "tmp.db", 0, DB_HASH, DB_CREATE, 0664 );
+
+ if ( err ) {
+ return 1;
+ }
+
+ err = DBref->close( DBref, 0 );
+
+ DBenv->close( DBenv, 0 );
+
+ unlink( "tmp.db" );
+ unlink( "__db.001" );
+ unlink( "__db.002" );
+ unlink( "__db.003" );
+ unlink( "__db.004" );
+ unlink( "__db.005" );
+
+ rmdir( logDir );
+
+ return 0;
+}
+
+int EXAM_IMPL(sleepycat_test::hash_open_cxx)
+{
DbEnv env( 0 );
const char logDir[] = "./DB_logs";
Modified: trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h 2008-08-13 16:27:09 UTC (rev 1959)
+++ trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h 2008-08-14 18:25:31 UTC (rev 1960)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/13 13:26:19 yeti>
+// -*- C++ -*- Time-stamp: <08/08/14 15:44:08 yeti>
/*
* Copyright (c) 2008
@@ -15,6 +15,7 @@
class sleepycat_test
{
public:
+ int EXAM_DECL(hash_open_cxx);
int EXAM_DECL(hash_open);
};
Modified: trunk/complement/explore/perf/DB/Berkeley/suite.cc
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/suite.cc 2008-08-13 16:27:09 UTC (rev 1959)
+++ trunk/complement/explore/perf/DB/Berkeley/suite.cc 2008-08-14 18:25:31 UTC (rev 1960)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/13 13:26:45 yeti>
+// -*- C++ -*- Time-stamp: <08/08/14 21:20:08 yeti>
/*
* Copyright (c) 2008
@@ -25,6 +25,7 @@
sleepycat_test st;
t.add( &sleepycat_test::hash_open, st, "Open DB with DB_HASH" );
+ t.add( &sleepycat_test::hash_open_cxx, st, "Open DB with DB_HASH, C++ interface" );
return t.girdle();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-08-13 16:27:13
|
Revision: 1959
http://complement.svn.sourceforge.net/complement/?rev=1959&view=rev
Author: complement
Date: 2008-08-13 16:27:09 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
Performance tests for Berkeley DB established
Added Paths:
-----------
trunk/complement/explore/perf/DB/
trunk/complement/explore/perf/DB/Berkeley/
trunk/complement/explore/perf/DB/Berkeley/Makefile
trunk/complement/explore/perf/DB/Berkeley/Makefile.inc
trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc
trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h
trunk/complement/explore/perf/DB/Berkeley/suite.cc
Property changes on: trunk/complement/explore/perf/DB/Berkeley
___________________________________________________________________
Added: svn:ignore
+ obj
Added: trunk/complement/explore/perf/DB/Berkeley/Makefile
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/Makefile (rev 0)
+++ trunk/complement/explore/perf/DB/Berkeley/Makefile 2008-08-13 16:27:09 UTC (rev 1959)
@@ -0,0 +1,45 @@
+# -*- Makefile -*- Time-stamp: <08/07/31 15:43:19 yeti>
+
+SRCROOT := ../../..
+
+include Makefile.inc
+include ${SRCROOT}/Makefiles/gmake/top.mak
+
+
+INCLUDES += -I$(SRCROOT)/include
+INCLUDES += -I..
+ifdef BOOST_DIR
+INCLUDES += -I$(BOOST_INCLUDE_DIR)
+endif
+DEFS += -D__FIT_EXAM
+
+LIBMT_DIR = ${SRCROOT}/lib/mt
+LIBMISC_DIR = ${SRCROOT}/lib/misc
+LIBEXAM_DIR = ${SRCROOT}/lib/exam
+
+ifeq ($(OSNAME),linux)
+
+release-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR} \
+ -L${LIBEXAM_DIR}/${OUTPUT_DIR} \
+ -L${LIBMISC_DIR}/${OUTPUT_DIR} \
+ -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR}:${LIBEXAM_DIR}/${OUTPUT_DIR}:${LIBMISC_DIR}/${OUTPUT_DIR}:${STLPORT_LIB_DIR}
+
+dbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_DBG} \
+ -L${LIBEXAM_DIR}/${OUTPUT_DIR_DBG} \
+ -L${LIBMISC_DIR}/${OUTPUT_DIR_DBG} \
+ -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_DBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_DBG}:${LIBMISC_DIR}/${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR}
+
+ifndef WITHOUT_STLPORT
+stldbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_STLDBG} \
+ -L${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG} \
+ -L${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG} \
+ -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_STLDBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG}:${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR}
+endif
+
+endif
+
+release-shared : LDLIBS = -lxmt -lexam -lmisc -ldb_cxx -ldb
+dbg-shared : LDLIBS = -lxmtg -lexamg -lmiscg -ldb_cxx -ldb
+ifndef WITHOUT_STLPORT
+stldbg-shared : LDLIBS = -lxmtstlg -lexamstlg -lmiscstlg -ldb_cxx -ldb
+endif
Added: trunk/complement/explore/perf/DB/Berkeley/Makefile.inc
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/Makefile.inc (rev 0)
+++ trunk/complement/explore/perf/DB/Berkeley/Makefile.inc 2008-08-13 16:27:09 UTC (rev 1959)
@@ -0,0 +1,4 @@
+# -*- makefile -*- Time-stamp: <08/07/28 23:56:21 ptr>
+
+PRGNAME = sleepycat_perf
+SRC_CC = suite.cc sc_perf_suite.cc
Added: trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc (rev 0)
+++ trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.cc 2008-08-13 16:27:09 UTC (rev 1959)
@@ -0,0 +1,56 @@
+// -*- C++ -*- Time-stamp: <08/08/13 13:28:22 yeti>
+
+/*
+ * Copyright (c) 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License Version 3.0
+ */
+
+#include "sc_perf_suite.h"
+#include <vector>
+
+#include <mt/thread>
+#include <mt/mutex>
+
+#include <db_cxx.h>
+#include <sys/stat.h>
+
+using namespace std;
+
+int EXAM_IMPL(sleepycat_test::hash_open)
+{
+ DbEnv env( 0 );
+ const char logDir[] = "./DB_logs";
+
+ mkdir( logDir, 0777 );
+
+ env.set_lg_dir( logDir );
+ env.set_flags(DB_AUTO_COMMIT | DB_LOG_INMEMORY | DB_LOG_AUTOREMOVE, 1);
+ env.open( ".", DB_INIT_TXN | DB_INIT_LOG | DB_CREATE | DB_INIT_MPOOL, 0600);
+
+ Db database( &env, 0 );
+
+ // This should suffice for most users.
+ database.set_h_nelem(30);
+ // The BDB documentation says the fill factor should be
+ // (pagesize - 32) / (average_key_size + average_data_size + 8);
+ // For labels, average key size = sizeof(TId) = 16, average data size = 0,
+ // supposing 4K pages this gives us 169 1/3 for the fill factor.
+ database.set_h_ffactor(150);
+ // For opening in the environment we should use a relative path.
+ database.open( 0, "tmp.db", 0, DB_HASH, DB_CREATE, 0600);
+
+ database.close( 0 );
+
+ unlink( "tmp.db" );
+ unlink( "__db.001" );
+ unlink( "__db.002" );
+ unlink( "__db.003" );
+ unlink( "__db.004" );
+ unlink( "__db.005" );
+
+ rmdir( logDir );
+
+ return 0;
+}
Added: trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h (rev 0)
+++ trunk/complement/explore/perf/DB/Berkeley/sc_perf_suite.h 2008-08-13 16:27:09 UTC (rev 1959)
@@ -0,0 +1,21 @@
+// -*- C++ -*- Time-stamp: <08/08/13 13:26:19 yeti>
+
+/*
+ * Copyright (c) 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License Version 3.0
+ */
+
+#ifndef __ALLOC_PERF_SUITE_H
+#define __ALLOC_PERF_SUITE_H
+
+#include <exam/suite.h>
+
+class sleepycat_test
+{
+ public:
+ int EXAM_DECL(hash_open);
+};
+
+#endif // __ALLOC_PERF_SUITE_H
Added: trunk/complement/explore/perf/DB/Berkeley/suite.cc
===================================================================
--- trunk/complement/explore/perf/DB/Berkeley/suite.cc (rev 0)
+++ trunk/complement/explore/perf/DB/Berkeley/suite.cc 2008-08-13 16:27:09 UTC (rev 1959)
@@ -0,0 +1,30 @@
+// -*- C++ -*- Time-stamp: <08/08/13 13:26:45 yeti>
+
+/*
+ * Copyright (c) 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License Version 3.0
+ */
+
+#include "sc_perf_suite.h"
+
+#include <exam/suite.h>
+#include <iostream>
+
+using namespace std;
+
+int main( int, char ** )
+{
+ exam::trivial_time_logger tl( cout );
+
+ exam::test_suite t( "Berkeley DB performance", 20 );
+
+ t.set_logger( &tl );
+
+ sleepycat_test st;
+
+ t.add( &sleepycat_test::hash_open, st, "Open DB with DB_HASH" );
+
+ return t.girdle();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-08-13 09:29:19
|
Revision: 1958
http://complement.svn.sourceforge.net/complement/?rev=1958&view=rev
Author: complement
Date: 2008-08-13 09:29:15 +0000 (Wed, 13 Aug 2008)
Log Message:
-----------
less expencive tests: free some memory
Modified Paths:
--------------
trunk/complement/explore/perf/alloc/alloc_perf_suite.cc
trunk/complement/explore/perf/alloc/alloc_perf_suite.h
trunk/complement/explore/perf/alloc/suite.cc
Modified: trunk/complement/explore/perf/alloc/alloc_perf_suite.cc
===================================================================
--- trunk/complement/explore/perf/alloc/alloc_perf_suite.cc 2008-08-12 14:32:04 UTC (rev 1957)
+++ trunk/complement/explore/perf/alloc/alloc_perf_suite.cc 2008-08-13 09:29:15 UTC (rev 1958)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/12 18:28:14 yeti>
+// -*- C++ -*- Time-stamp: <08/08/13 13:28:22 yeti>
/*
* Copyright (c) 2008
@@ -8,13 +8,23 @@
*/
#include "alloc_perf_suite.h"
+#include <vector>
+#include <mt/thread>
+#include <mt/mutex>
+
using namespace std;
+vector<void *> p( 1000 );
+
int EXAM_IMPL(alloc_test::alloc)
{
for ( int i = 0; i < 10000; ++i ) {
- if ( malloc( 100 ) == 0 ) {
+ if ( p[i % 1000] != 0 ) {
+ free( p[i % 1000] );
+ }
+ p[i % 1000] = malloc( 100 );
+ if ( p[i % 1000] == 0 ) {
return 1;
}
}
@@ -25,7 +35,11 @@
int EXAM_IMPL(alloc_test::alloc5000)
{
for ( int i = 0; i < 10000; ++i ) {
- if ( malloc( 5000 ) == 0 ) {
+ if ( p[i % 1000] != 0 ) {
+ free( p[i % 1000] );
+ }
+ p[i % 1000] = malloc( 5000 );
+ if ( p[i % 1000] == 0 ) {
return 1;
}
}
@@ -36,7 +50,11 @@
int EXAM_IMPL(alloc_test::alloc_mix)
{
for ( int i = 0; i < 5000; ++i ) {
- if ( malloc( 5000 ) == 0 ) {
+ if ( p[i % 1000] != 0 ) {
+ free( p[i % 1000] );
+ }
+ p[i % 1000] = malloc( 5000 );
+ if ( p[i % 1000] == 0 ) {
return 1;
}
if ( malloc( 100 ) == 0 ) {
@@ -46,3 +64,34 @@
return 0;
}
+
+static std::tr2::mutex lk;
+
+void a0()
+{
+ for ( int i = 0; i < 10000; ++i ) {
+ std::tr2::lock_guard<std::tr2::mutex> lock( lk );
+
+ if ( p[i % 1000] != 0 ) {
+ free( p[i % 1000] );
+ }
+ p[i % 1000] = malloc( 100 );
+ }
+}
+
+int EXAM_IMPL(alloc_test::alloc_t5)
+{
+ std::tr2::basic_thread<0,0> t0( a0 );
+ std::tr2::basic_thread<0,0> t1( a0 );
+ std::tr2::basic_thread<0,0> t2( a0 );
+ std::tr2::basic_thread<0,0> t3( a0 );
+ std::tr2::basic_thread<0,0> t4( a0 );
+
+ t0.join();
+ t1.join();
+ t2.join();
+ t3.join();
+ t4.join();
+
+ return 0;
+}
Modified: trunk/complement/explore/perf/alloc/alloc_perf_suite.h
===================================================================
--- trunk/complement/explore/perf/alloc/alloc_perf_suite.h 2008-08-12 14:32:04 UTC (rev 1957)
+++ trunk/complement/explore/perf/alloc/alloc_perf_suite.h 2008-08-13 09:29:15 UTC (rev 1958)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/12 18:28:37 yeti>
+// -*- C++ -*- Time-stamp: <08/08/13 13:26:19 yeti>
/*
* Copyright (c) 2008
@@ -18,6 +18,7 @@
int EXAM_DECL(alloc);
int EXAM_DECL(alloc5000);
int EXAM_DECL(alloc_mix);
+ int EXAM_DECL(alloc_t5);
};
#endif // __ALLOC_PERF_SUITE_H
Modified: trunk/complement/explore/perf/alloc/suite.cc
===================================================================
--- trunk/complement/explore/perf/alloc/suite.cc 2008-08-12 14:32:04 UTC (rev 1957)
+++ trunk/complement/explore/perf/alloc/suite.cc 2008-08-13 09:29:15 UTC (rev 1958)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/12 18:27:28 yeti>
+// -*- C++ -*- Time-stamp: <08/08/13 13:26:45 yeti>
/*
* Copyright (c) 2008
@@ -27,6 +27,7 @@
t.add( &alloc_test::alloc, alt, "malloc" );
t.add( &alloc_test::alloc5000, alt, "malloc 5000" );
t.add( &alloc_test::alloc_mix, alt, "malloc mix" );
+ t.add( &alloc_test::alloc_t5, alt, "malloc 5 threads" );
return t.girdle();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-08-12 14:32:08
|
Revision: 1957
http://complement.svn.sourceforge.net/complement/?rev=1957&view=rev
Author: complement
Date: 2008-08-12 14:32:04 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
add tests: big alloc and mix of big and small alloc
Modified Paths:
--------------
trunk/complement/explore/perf/alloc/alloc_perf_suite.cc
trunk/complement/explore/perf/alloc/alloc_perf_suite.h
trunk/complement/explore/perf/alloc/suite.cc
Modified: trunk/complement/explore/perf/alloc/alloc_perf_suite.cc
===================================================================
--- trunk/complement/explore/perf/alloc/alloc_perf_suite.cc 2008-08-12 14:08:09 UTC (rev 1956)
+++ trunk/complement/explore/perf/alloc/alloc_perf_suite.cc 2008-08-12 14:32:04 UTC (rev 1957)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/12 18:06:06 yeti>
+// -*- C++ -*- Time-stamp: <08/08/12 18:28:14 yeti>
/*
* Copyright (c) 2008
@@ -21,3 +21,28 @@
return 0;
}
+
+int EXAM_IMPL(alloc_test::alloc5000)
+{
+ for ( int i = 0; i < 10000; ++i ) {
+ if ( malloc( 5000 ) == 0 ) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int EXAM_IMPL(alloc_test::alloc_mix)
+{
+ for ( int i = 0; i < 5000; ++i ) {
+ if ( malloc( 5000 ) == 0 ) {
+ return 1;
+ }
+ if ( malloc( 100 ) == 0 ) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
Modified: trunk/complement/explore/perf/alloc/alloc_perf_suite.h
===================================================================
--- trunk/complement/explore/perf/alloc/alloc_perf_suite.h 2008-08-12 14:08:09 UTC (rev 1956)
+++ trunk/complement/explore/perf/alloc/alloc_perf_suite.h 2008-08-12 14:32:04 UTC (rev 1957)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/12 16:51:28 yeti>
+// -*- C++ -*- Time-stamp: <08/08/12 18:28:37 yeti>
/*
* Copyright (c) 2008
@@ -16,6 +16,8 @@
{
public:
int EXAM_DECL(alloc);
+ int EXAM_DECL(alloc5000);
+ int EXAM_DECL(alloc_mix);
};
#endif // __ALLOC_PERF_SUITE_H
Modified: trunk/complement/explore/perf/alloc/suite.cc
===================================================================
--- trunk/complement/explore/perf/alloc/suite.cc 2008-08-12 14:08:09 UTC (rev 1956)
+++ trunk/complement/explore/perf/alloc/suite.cc 2008-08-12 14:32:04 UTC (rev 1957)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/08/12 16:48:21 yeti>
+// -*- C++ -*- Time-stamp: <08/08/12 18:27:28 yeti>
/*
* Copyright (c) 2008
@@ -25,6 +25,8 @@
alloc_test alt;
t.add( &alloc_test::alloc, alt, "malloc" );
+ t.add( &alloc_test::alloc5000, alt, "malloc 5000" );
+ t.add( &alloc_test::alloc_mix, alt, "malloc mix" );
return t.girdle();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-08-12 14:08:15
|
Revision: 1956
http://complement.svn.sourceforge.net/complement/?rev=1956&view=rev
Author: complement
Date: 2008-08-12 14:08:09 +0000 (Tue, 12 Aug 2008)
Log Message:
-----------
performance: why systems deffer in performance? check malloc; initial test
Added Paths:
-----------
trunk/complement/explore/perf/alloc/
trunk/complement/explore/perf/alloc/Makefile
trunk/complement/explore/perf/alloc/Makefile.inc
trunk/complement/explore/perf/alloc/alloc_perf_suite.cc
trunk/complement/explore/perf/alloc/alloc_perf_suite.h
trunk/complement/explore/perf/alloc/suite.cc
Property changes on: trunk/complement/explore/perf/alloc
___________________________________________________________________
Added: svn:ignore
+ obj
Added: trunk/complement/explore/perf/alloc/Makefile
===================================================================
--- trunk/complement/explore/perf/alloc/Makefile (rev 0)
+++ trunk/complement/explore/perf/alloc/Makefile 2008-08-12 14:08:09 UTC (rev 1956)
@@ -0,0 +1,45 @@
+# -*- Makefile -*- Time-stamp: <08/07/31 15:43:19 yeti>
+
+SRCROOT := ../..
+
+include Makefile.inc
+include ${SRCROOT}/Makefiles/gmake/top.mak
+
+
+INCLUDES += -I$(SRCROOT)/include
+INCLUDES += -I..
+ifdef BOOST_DIR
+INCLUDES += -I$(BOOST_INCLUDE_DIR)
+endif
+DEFS += -D__FIT_EXAM
+
+LIBMT_DIR = ${SRCROOT}/lib/mt
+LIBMISC_DIR = ${SRCROOT}/lib/misc
+LIBEXAM_DIR = ${SRCROOT}/lib/exam
+
+ifeq ($(OSNAME),linux)
+
+release-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR} \
+ -L${LIBEXAM_DIR}/${OUTPUT_DIR} \
+ -L${LIBMISC_DIR}/${OUTPUT_DIR} \
+ -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR}:${LIBEXAM_DIR}/${OUTPUT_DIR}:${LIBMISC_DIR}/${OUTPUT_DIR}:${STLPORT_LIB_DIR}
+
+dbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_DBG} \
+ -L${LIBEXAM_DIR}/${OUTPUT_DIR_DBG} \
+ -L${LIBMISC_DIR}/${OUTPUT_DIR_DBG} \
+ -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_DBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_DBG}:${LIBMISC_DIR}/${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR}
+
+ifndef WITHOUT_STLPORT
+stldbg-shared: LDFLAGS += -L${LIBMT_DIR}/${OUTPUT_DIR_STLDBG} \
+ -L${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG} \
+ -L${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG} \
+ -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_STLDBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG}:${LIBMISC_DIR}/${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR}
+endif
+
+endif
+
+release-shared : LDLIBS = -lxmt -lexam -lmisc
+dbg-shared : LDLIBS = -lxmtg -lexamg -lmiscg
+ifndef WITHOUT_STLPORT
+stldbg-shared : LDLIBS = -lxmtstlg -lexamstlg -lmiscstlg
+endif
Added: trunk/complement/explore/perf/alloc/Makefile.inc
===================================================================
--- trunk/complement/explore/perf/alloc/Makefile.inc (rev 0)
+++ trunk/complement/explore/perf/alloc/Makefile.inc 2008-08-12 14:08:09 UTC (rev 1956)
@@ -0,0 +1,4 @@
+# -*- makefile -*- Time-stamp: <08/07/28 23:56:21 ptr>
+
+PRGNAME = alloc_perf
+SRC_CC = suite.cc alloc_perf_suite.cc
Added: trunk/complement/explore/perf/alloc/alloc_perf_suite.cc
===================================================================
--- trunk/complement/explore/perf/alloc/alloc_perf_suite.cc (rev 0)
+++ trunk/complement/explore/perf/alloc/alloc_perf_suite.cc 2008-08-12 14:08:09 UTC (rev 1956)
@@ -0,0 +1,23 @@
+// -*- C++ -*- Time-stamp: <08/08/12 18:06:06 yeti>
+
+/*
+ * Copyright (c) 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License Version 3.0
+ */
+
+#include "alloc_perf_suite.h"
+
+using namespace std;
+
+int EXAM_IMPL(alloc_test::alloc)
+{
+ for ( int i = 0; i < 10000; ++i ) {
+ if ( malloc( 100 ) == 0 ) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
Added: trunk/complement/explore/perf/alloc/alloc_perf_suite.h
===================================================================
--- trunk/complement/explore/perf/alloc/alloc_perf_suite.h (rev 0)
+++ trunk/complement/explore/perf/alloc/alloc_perf_suite.h 2008-08-12 14:08:09 UTC (rev 1956)
@@ -0,0 +1,21 @@
+// -*- C++ -*- Time-stamp: <08/08/12 16:51:28 yeti>
+
+/*
+ * Copyright (c) 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License Version 3.0
+ */
+
+#ifndef __ALLOC_PERF_SUITE_H
+#define __ALLOC_PERF_SUITE_H
+
+#include <exam/suite.h>
+
+class alloc_test
+{
+ public:
+ int EXAM_DECL(alloc);
+};
+
+#endif // __ALLOC_PERF_SUITE_H
Added: trunk/complement/explore/perf/alloc/suite.cc
===================================================================
--- trunk/complement/explore/perf/alloc/suite.cc (rev 0)
+++ trunk/complement/explore/perf/alloc/suite.cc 2008-08-12 14:08:09 UTC (rev 1956)
@@ -0,0 +1,30 @@
+// -*- C++ -*- Time-stamp: <08/08/12 16:48:21 yeti>
+
+/*
+ * Copyright (c) 2008
+ * Petr Ovtchenkov
+ *
+ * Licensed under the Academic Free License Version 3.0
+ */
+
+#include "alloc_perf_suite.h"
+
+#include <exam/suite.h>
+#include <iostream>
+
+using namespace std;
+
+int main( int, char ** )
+{
+ exam::trivial_time_logger tl( cout );
+
+ exam::test_suite t( "alloc performance", 20 );
+
+ t.set_logger( &tl );
+
+ alloc_test alt;
+
+ t.add( &alloc_test::alloc, alt, "malloc" );
+
+ return t.girdle();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-08-04 12:53:05
|
Revision: 1955
http://complement.svn.sourceforge.net/complement/?rev=1955&view=rev
Author: complement
Date: 2008-08-04 12:53:02 +0000 (Mon, 04 Aug 2008)
Log Message:
-----------
compile with libstdc++
Modified Paths:
--------------
trunk/complement/explore/include/mt/system_error
Modified: trunk/complement/explore/include/mt/system_error
===================================================================
--- trunk/complement/explore/include/mt/system_error 2008-08-04 12:52:35 UTC (rev 1954)
+++ trunk/complement/explore/include/mt/system_error 2008-08-04 12:53:02 UTC (rev 1955)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/25 08:47:37 ptr>
+// -*- C++ -*- Time-stamp: <08/08/04 16:09:09 yeti>
/*
* Copyright (c) 2007-2008
@@ -21,7 +21,77 @@
#ifdef STLPORT
#include <type_traits>
#else
-...
+#include <tr1/type_traits>
+
+namespace std {
+
+namespace tr1 {
+
+namespace detail {
+
+template <bool,class _U>
+struct _decay_aux2
+{
+ typedef typename remove_cv<_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux2<true,_U>
+{
+ typedef typename add_pointer<_U>::type type;
+};
+
+template <bool, class _U>
+struct _decay_aux1
+{
+ typedef typename _decay_aux2<is_function<_U>::value,_U>::type type;
+};
+
+template <class _U>
+struct _decay_aux1<true,_U>
+{
+ typedef typename remove_extent<_U>::type* type;
+};
+
+} // namespace detail
+
+template <class _Tp>
+class decay
+{
+ private:
+ typedef typename remove_reference<_Tp>::type _U;
+
+ public:
+ typedef typename detail::_decay_aux1<is_array<_U>::value,_U>::type type;
+};
+
+template <bool, class _Tp = void>
+struct enable_if
+{
+};
+
+template <class _Tp>
+struct enable_if<true,_Tp>
+{
+ typedef _Tp type;
+};
+
+template <bool, class _Tp1, class _Tp2>
+struct conditional
+{
+ typedef _Tp2 type;
+};
+
+template <class _Tp1, class _Tp2>
+struct conditional<true,_Tp1,_Tp2>
+{
+ typedef _Tp1 type;
+};
+
+} // namespace tr1
+
+} // namesapce std
+
#endif
#include <cerrno>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <com...@us...> - 2008-08-04 12:52:41
|
Revision: 1954
http://complement.svn.sourceforge.net/complement/?rev=1954&view=rev
Author: complement
Date: 2008-08-04 12:52:35 +0000 (Mon, 04 Aug 2008)
Log Message:
-----------
compile with libstdc++
Modified Paths:
--------------
trunk/complement/explore/lib/mt/uid.cc
Modified: trunk/complement/explore/lib/mt/uid.cc
===================================================================
--- trunk/complement/explore/lib/mt/uid.cc 2008-07-30 17:27:06 UTC (rev 1953)
+++ trunk/complement/explore/lib/mt/uid.cc 2008-08-04 12:52:35 UTC (rev 1954)
@@ -1,4 +1,4 @@
-// -*- C++ -*- Time-stamp: <08/07/30 19:12:12 ptr>
+// -*- C++ -*- Time-stamp: <08/08/04 16:32:11 yeti>
/*
* Copyright (c) 2006, 2008
@@ -24,7 +24,11 @@
std::ostream& operator <<( std::ostream& s, const xmt::uuid_type& uid )
{
+#ifdef STLPORT
std::ios_base::fmtflags f = s.flags( 0 );
+#else // i.e. libstdc++
+ std::ios_base::fmtflags f = s.flags( static_cast<std::ios_base::fmtflags>(0) );
+#endif
s << hex << setfill('0')
<< setw(2) << static_cast<unsigned>(uid.u.b[0])
<< setw(2) << static_cast<unsigned>(uid.u.b[1])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|