From MAILER-DAEMON Sun Nov 02 18:55:28 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AGS1q-00044E-7H
	for mharc-bug-commoncpp@gnu.org; Sun, 02 Nov 2003 18:53:06 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AGS10-0003AF-MQ
	for bug-commoncpp@gnu.org; Sun, 02 Nov 2003 18:52:14 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AGS0L-0002QD-E9
	for bug-commoncpp@gnu.org; Sun, 02 Nov 2003 18:52:04 -0500
Received: from [144.135.24.153] (helo=mta05bw.bigpond.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AGRzO-0001IR-G9
	for bug-commoncpp@gnu.org; Sun, 02 Nov 2003 18:50:34 -0500
Received: from udderish ([144.135.24.94]) by mta05bw.email.bigpond.com
	(iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003))
	with SMTP id <0HNR00F2B0TWLN@mta05bw.email.bigpond.com> for
	bug-commoncpp@gnu.org; Mon, 03 Nov 2003 09:49:09 +1000 (EST)
Received: from cpe-203-51-180-216.vic.bigpond.net.au ([203.51.180.216])
	by bwmam09.mailsvc.email.bigpond.com(MAM REL_3_3_2c 144/5796039); Mon,
	03 Nov 2003 09:49:08 +0000
Date: Mon, 03 Nov 2003 10:49:08 +1100
From: Julie Russell <julie.russell@throughput.com.au>
In-reply-to: <E1AG1xR-0004Vd-UB@monty-python.gnu.org>
To: bug-commoncpp@gnu.org
Message-id: <CAEDLLCOCGBPMAAFIFOCOEKJCAAA.julie.russell@throughput.com.au>
MIME-version: 1.0
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Importance: Normal
X-Priority: 3 (Normal)
X-MSMail-priority: Normal
Subject: RE: Bug-commoncpp Digest, Vol 12, Issue 1
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 02 Nov 2003 23:52:45 -0000

Hi there!

I am not a big expert on this package, but the code in this thread package
is very similar to Java. You would do something like this:

class MultipleServices {
private:
	MyThread *service_1;
	MyThread *service_2;
public:
	MultipleServices();

};

#include "MultipleServices.h"
MultipleServices::MultipleServices() {
	this->service_1 = new MyThread(server_port_1);
	this->service_2 = new MyThread(server_port_2);
	this->service_1->start();
	this->service_2->start();
	// or if you want to start the thread off as detached
	//this->service_1->detach();
	//this->service_2->detach();
}



class MyThread : public Thread {
private:
	ServerSocket* serverSocket;
public:
	// MyThread's run method is describe briefly below:
	void run();
};

#include "MyThread.h"
void MyThread::run() {
	serverSocket = new ServerSocket(port);
	while (true) {
		sock = serverSocket->suspend(); // block till someone connects
		sock->resume(); // resume thread??

		// not sure what you are doing here as I do not know the java thread
libraries that
		// well but I assume you are trying to suspend a thread and resume it when
some event happens?
		// anyway if that's the case you use suspend() and resume(), or you
setSuspend(...) depending on
		// what you are trying to do...
	}
}

Hope this helps...
Regards,
Julie.


> -----Original Message-----
> From: bug-commoncpp-bounces+julie.russell=throughput.com.au@gnu.org
> [mailto:bug-commoncpp-bounces+julie.russell=throughput.com.au@gnu.org]On
> Behalf Of bug-commoncpp-request@gnu.org
> Sent: Sunday, 2 November 2003 7:03 AM
> To: bug-commoncpp@gnu.org
> Subject: Bug-commoncpp Digest, Vol 12, Issue 1
>
>
> *This message was transferred with a trial version of CommuniGate(tm) Pro*
> Send Bug-commoncpp mailing list submissions to
> 	bug-commoncpp@gnu.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> or, via email, send a message with subject or body 'help' to
> 	bug-commoncpp-request@gnu.org
>
> You can reach the person managing the list at
> 	bug-commoncpp-owner@gnu.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Bug-commoncpp digest..."
>
>
> Today's Topics:
>
>    1. newbie question: help with writing multithreaded server
>       (deshmua@mail.ececs.uc.edu)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 31 Oct 2003 21:42:00 -0500 (EST)
> From: deshmua@mail.ececs.uc.edu
> Subject: newbie question: help with writing multithreaded server
> To: bug-commoncpp@gnu.org
> Message-ID: <1067654520.3fa31d78a6286@webmail.uc.edu>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> ** sorry for posting a newbie question here, if there is a
> separate list for
> such questions, please let it be known ***
>
> I just started using GNU Common C++. I have a problem understanding
> the class organization of this package. I'm trying to create
> a class that starts off multiple TCP servers (each in a separate thread).
> Is there something analogous to the Java ServerSocket class that creates
> and listens on a socket to accept connections (which may be eventually
> services in a separate thread)
>
> I come from Java background, so I find it difficult to understand why
> such a simple task seems to be so complicated with this library.
> Ideally I am looking for something like:
>
> --------------------snip code---------------------
> // in the class "MultipleServices"
> class MultipleServices {
> MyThread *service_1;
> MyThread *service_2;
> .
> .
> .
> // in constructor or some method...
> *service_1 = new MyThread(server_port_1);
> *service_2 = new MyThread(server_port_2);
> service_1->start();
> service_2->start();
> .
> .
> .
> }; // class MultipleServices ends.
>
>
>
> class MyThread : public Thread {
> .
> .
> .
> // MyThread's run method is describe briefly below:
> void run() {
>     serverSocket = new ServerSocket(port);
>     while (true) {
>         sock = serverSocket->accept(); // block till someone connects
>         service(sock); // this may or may not start in its on thread
>     }
> }
> }; // class MyThread ends
> --------------------snip code---------------------
>
> Can anyone write the same code in a concise way using the "GNU Common C++"
> library. I'm particularly confused since I cannot understand GNU
> Common C++
> analogy to ServerSocket class in Java.
>
> TIA,
> ~ amol
>
>
>
> ------------------------------
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>
>
> End of Bug-commoncpp Digest, Vol 12, Issue 1
> ********************************************
>
>





From MAILER-DAEMON Tue Nov 04 05:11:46 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AGyA6-0003Ql-EO
	for mharc-bug-commoncpp@gnu.org; Tue, 04 Nov 2003 05:11:46 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AGyA3-0003Pi-D3
	for bug-commoncpp@gnu.org; Tue, 04 Nov 2003 05:11:43 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AGy9W-0003Fj-0q
	for bug-commoncpp@gnu.org; Tue, 04 Nov 2003 05:11:42 -0500
Received: from [129.13.64.97] (helo=mailgate.rz.uni-karlsruhe.de)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AGy9V-0003FV-Kv
	for bug-commoncpp@gnu.org; Tue, 04 Nov 2003 05:11:09 -0500
Received: from gmx.de (i81pc13.irf.uni-karlsruhe.de [141.3.74.14])
	by mailgate.rz.uni-karlsruhe.de with esmtp (Exim 3.36 #1)
	id 1AGy9T-0001WP-00; Tue, 04 Nov 2003 11:11:07 +0100
Message-ID: <3FA77C2E.7020405@gmx.de>
Date: Tue, 04 Nov 2003 11:15:10 +0100
From: Daniel Hahn <dhahn@gmx.de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
	rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Thread has inconsistent object state
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 04 Nov 2003 10:11:44 -0000

Hi,

I have the problem that under certain circustance my Thread object will 
have inconsisten object states - this is only under WIN32 with Visual 
Studio .NET (7.1), Linux/gcc-3.3 seems to work.

Here is it: I have a singleton class like this

class Single : public Thread {

static Single& getInstance() { return myInstance; }

void init() {
    x = 23;
    cout  << "Init: x is " << x;
}

void run() {
    cout << "Thread running, x is " << x;
}

private:
    int x;
    static Single myInstance;
    Single() {
        x=17;
        cout << "Constructor: x is " << x";
    }
} // End of class

If I use this class and call:

Single& single = Single::getInstance();
single.init();
single.start();

I will get the follwing result:
 > Constructor: x is 17
 > Init: x is 23
 > Thread running, x is 17

It seems like the Thread that is started has a different data set then 
the object I was working with before. I have no idea why that is so...

Regards,
                                     Daniel Hahn




From MAILER-DAEMON Wed Nov 05 10:17:42 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AHPPh-00084A-Kl
	for mharc-bug-commoncpp@gnu.org; Wed, 05 Nov 2003 10:17:41 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AHPPe-000833-BX
	for bug-commoncpp@gnu.org; Wed, 05 Nov 2003 10:17:38 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AHPP3-0007qk-14
	for bug-commoncpp@gnu.org; Wed, 05 Nov 2003 10:17:32 -0500
Received: from [193.98.115.211] (helo=bns1.envia-tel.net)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AHPP2-0007pn-2A
	for bug-commoncpp@gnu.org; Wed, 05 Nov 2003 10:17:00 -0500
Received: from mailserver.wige-data.de (gw1.wige-data.de [80.243.44.1])
	by bns1.envia-tel.net (8.12.10/8.12.10) with ESMTP id hA5FGtGH009963
	for <bug-commoncpp@gnu.org>; Wed, 5 Nov 2003 16:16:55 +0100
Received: by mailserver.wige-data.de with Internet Mail Service (5.5.2653.19)
	id <4SJL6JG9>; Wed, 5 Nov 2003 16:16:50 +0100
Received: from wige-data.de (dialin-145-254-172-145.arcor-ip.net
	[145.254.172.145]) by mailserver.wige-data.de with SMTP
	(Microsoft Exchange Internet Mail Service Version 5.5.2653.13)
	id 4SJL6JG8; Wed, 5 Nov 2003 16:16:45 +0100
From: taraben.a@wige-data.de
To: bug-commoncpp@gnu.org
Message-ID: <3FA914D9.1070200@wige-data.de>
Date: Wed, 05 Nov 2003 16:18:49 +0100
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
	rv:1.5) Gecko/20031013 Thunderbird/0.3
X-Accept-Language: en-us, en
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Problems creating ccext2.dll on Win32 using MinGW
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 05 Nov 2003 15:17:39 -0000

Hello,

I am using latest MinGW and commoncpp 1.0.13.
I commented out HAVE_OLD_STREAM, COMMON_XML_PARSING and HAVE_LIBXML.

Then i make the makefile.gcc in the win32 directory. ccgnu2.dll is 
created fine but the are numerous errors linking the ccext2.dll.

I have no glue whats going on I guess there are some problems linking to 
the ccgnu2 functions used in the ccext2 part.?

Has someone made a proper library using mingw?
When I run ./configure (under msys) and then make it says that nothing 
is to be done but no file was compiled ??

Thanks for any hint.

Adib.


Here are the linker messages:

dllwrap --export-all --output-def ccgnu2.def --implib libccgnu2.a 
--driver-name
c++ -o ccgnu2.dll \
thread.o mutex.o semaphore.o threadkey.o friends.o event.o slog.o dir.o 
file.o i
naddr.o peer.o port.o socket.o network.o serial.o mempager.o keydata.o 
dso.o exc
eption.o process.o urlstring.o libgnu2.o -Lc:/usr/dll -lws2_32
dllwrap: no export definition file provided.
Creating one, but that may not be what you want



dllwrap --export-all --output-def ccext2.def --implib libccext2.a 
--driver-name
c++ -o ccext2.dll \
buffer.o fifo.o pipe.o numbers.o cmdoptns.o url.o xml.o persist.o 
engine.o diges
t.o sha.o date.o groups.o md5.o unix.o ftp.o libgnu2.o -L. -Lc:/usr/dll 
-lccgnu2
  -lws2_32
dllwrap: no export definition file provided.
Creating one, but that may not be what you want
Info: resolving __ZTVN3ost9TCPStreamE by linking to 
__imp___ZTVN3ost9TCPStreamE
(auto-import)
url.o(.text$_ZN3ost9TCPStreamD2Ev+0x3d): In function 
`ZThn108_N3ost9URLStreamD0E
v':
c:/MinGW/include/c++/3.3.1/bits/basic_ios.h: variable 'vtable for 
ost::TCPStream
' can't be auto-imported. Please read the documentation for ld's 
--enable-auto-i
mport for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x9):c:/MinGW/include/c++/3.3.1/bits/basic_ios
.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read the
  documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x3c):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x43):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x4a):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x57):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x36):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x3c):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x43):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x4a):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x57):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'vtable for ost::TCPStream' can't be auto-imported. Please 
read th
e documentation for ld's --enable-auto-import for details.
Info: resolving __ZTTN3ost9TCPStreamE by linking to 
__imp___ZTTN3ost9TCPStreamE
(auto-import)
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x77):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x85):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x8d):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x98):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0xa6):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0xaf):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0xba):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x18e): In function 
`ZN3ost9URLStreamC1Em':
c:/usr/src/commoncpp2-1.0.13/win32/../src/url.cpp:77: variable 'VTT for 
ost::TCP
Stream' can't be auto-imported. Please read the documentation for ld's 
--enable-
auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x19c):c:/usr/src/commoncpp2-1.0.13/win32/../s
rc/url.cpp:77: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please
read the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x1a4):c:/usr/src/commoncpp2-1.0.13/win32/../s
rc/url.cpp:77: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please
read the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x1af): In function 
`ZN3ost9URLStreamC1Em':
c:/MinGW/include/c++/3.3.1/bits/basic_ios.h:417: variable 'VTT for 
ost::TCPStrea
m' can't be auto-imported. Please read the documentation for ld's 
--enable-auto-
import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x1bd):c:/MinGW/include/c++/3.3.1/bits/basic_i
os.h:417: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please read
the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x1c6):c:/MinGW/include/c++/3.3.1/bits/basic_i
os.h:417: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please read
the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x1d1): In function 
`ZN3ost9URLStreamC1Em':
c:/usr/src/commoncpp2-1.0.13/win32/../src/url.cpp:79: variable 'VTT for 
ost::TCP
Stream' can't be auto-imported. Please read the documentation for ld's 
--enable-
auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x2d1): In function 
`ZN3ost9URLStreamC1Em':
c:/MinGW/include/c++/3.3.1/bits/basic_ios.h:255: variable 'VTT for 
ost::TCPStrea
m' can't be auto-imported. Please read the documentation for ld's 
--enable-auto-
import for details.
url.o(.text$_ZN3ost9TCPStreamD1Ev+0x2de):c:/MinGW/include/c++/3.3.1/bits/basic_i
os.h:255: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please read
the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x77): In function 
`ZThn108_N3ost9URLStreamD0E
v':
c:/MinGW/include/c++/3.3.1/bits/basic_ios.h: variable 'VTT for 
ost::TCPStream' c
an't be auto-imported. Please read the documentation for ld's 
--enable-auto-impo
rt for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x85):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x8d):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x98):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0xa6):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0xaf):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0xba):c:/MinGW/include/c++/3.3.1/bits/basic_io
s.h: variable 'VTT for ost::TCPStream' can't be auto-imported. Please 
read the d
ocumentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x199): In function 
`ZN3ost9URLStreamC1Em':
c:/usr/src/commoncpp2-1.0.13/win32/../src/url.cpp:77: variable 'VTT for 
ost::TCP
Stream' can't be auto-imported. Please read the documentation for ld's 
--enable-
auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x1a7): In function 
`ZN3ost9URLStreamC1Em':
c:/MinGW/include/c++/3.3.1/bits/basic_ios.h:417: variable 'VTT for 
ost::TCPStrea
m' can't be auto-imported. Please read the documentation for ld's 
--enable-auto-
import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x1af):c:/MinGW/include/c++/3.3.1/bits/basic_i
os.h:417: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please read
the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x1ba):c:/MinGW/include/c++/3.3.1/bits/basic_i
os.h:417: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please read
the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x1c8): In function 
`ZN3ost9URLStreamC1Em':
c:/usr/src/commoncpp2-1.0.13/win32/../src/url.cpp:79: variable 'VTT for 
ost::TCP
Stream' can't be auto-imported. Please read the documentation for ld's 
--enable-
auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x1d1):c:/usr/src/commoncpp2-1.0.13/win32/../s
rc/url.cpp:79: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please
read the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x1dc):c:/usr/src/commoncpp2-1.0.13/win32/../s
rc/url.cpp:79: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please
read the documentation for ld's --enable-auto-import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x2d1): In function 
`ZN3ost9URLStreamC1Em':
c:/MinGW/include/c++/3.3.1/bits/basic_ios.h:255: variable 'VTT for 
ost::TCPStrea
m' can't be auto-imported. Please read the documentation for ld's 
--enable-auto-
import for details.
url.o(.text$_ZN3ost9TCPStreamD0Ev+0x2de):c:/MinGW/include/c++/3.3.1/bits/basic_i
os.h:255: variable 'VTT for ost::TCPStream' can't be auto-imported. 
Please read
the documentation for ld's --enable-auto-import for details.
Info: resolving __ZTVN3ost3DSOE by linking to __imp___ZTVN3ost3DSOE 
(auto-import
)
groups.o(.text+0x18): In function `ZN3ost11ThreadGroupD0Ev':
c:/usr/src/commoncpp2-1.0.13/win32/../include/cc++/groups.h: variable 
'vtable fo
r ost::DSO' can't be auto-imported. Please read the documentation for 
ld's --ena
ble-auto-import for details.
groups.o(.text+0x68): In function `ZN3ost11PluginGroupC1EPPS0_PKcb':
c:/usr/src/commoncpp2-1.0.13/win32/../include/cc++/file.h:989: variable 
'vtable
for ost::DSO' can't be auto-imported. Please read the documentation for 
ld's --e
nable-auto-import for details.
groups.o(.text+0xb2): In function `ZN3ost11PluginGroupC2EPKcb':
c:/usr/src/commoncpp2-1.0.13/win32/../include/cc++/file.h:989: variable 
'vtable
for ost::DSO' can't be auto-imported. Please read the documentation for 
ld's --e
nable-auto-import for details.
groups.o(.text+0x102): In function `ZN3ost11PluginGroupC1EPKcb':
c:/usr/src/commoncpp2-1.0.13/win32/../include/cc++/file.h:989: variable 
'vtable
for ost::DSO' can't be auto-imported. Please read the documentation for 
ld's --e
nable-auto-import for details.
nmth000000.o(.idata$4+0x0): undefined reference to 
`_nm___ZTVN3ost9TCPStreamE'
nmth000001.o(.idata$4+0x0): undefined reference to 
`_nm___ZTTN3ost9TCPStreamE'
nmth000002.o(.idata$4+0x0): undefined reference to `_nm___ZTVN3ost3DSOE'
dllwrap: c++ exited with status 1
make: *** [ccext2.dll] Error 1



From MAILER-DAEMON Tue Nov 11 09:58:36 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AJZyW-0004CI-GH
	for mharc-bug-commoncpp@gnu.org; Tue, 11 Nov 2003 09:58:36 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AJWzM-0000mB-BK
	for bug-commoncpp@gnu.org; Tue, 11 Nov 2003 06:47:16 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AJWyT-0000S9-6v
	for bug-commoncpp@gnu.org; Tue, 11 Nov 2003 06:46:51 -0500
Received: from [213.143.52.64] (helo=MXFUSV28)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AJWx3-00009d-37
	for bug-commoncpp@gnu.org; Tue, 11 Nov 2003 06:44:53 -0500
Received: from blinux.red.isotrol.com ([172.22.190.34])
	by SMTP2-sva.amenate.com
	(iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003))
	with ESMTPA id <0HO600837NHGU9@SMTP2-sva.amenate.com> for
	bug-commoncpp@gnu.org; Tue, 11 Nov 2003 11:22:29 +0100 (MET)
Date: Tue, 11 Nov 2003 11:21:51 +0100
From: Borja Pacheco <borja.pacheco@amena.com>
To: bug-commoncpp@gnu.org
Message-id: <1068546110.1835.27.camel@blinux.red.isotrol.com>
MIME-version: 1.0
X-Mailer: Ximian Evolution 1.4.5
Content-type: multipart/alternative;
	boundary="Boundary_(ID_RLVHl1Uq/8vA0+9hyFiTRw)"
X-Mailman-Approved-At: Tue, 11 Nov 2003 09:58:35 -0500
Subject: Thread activation bug
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Nov 2003 11:49:31 -0000


--Boundary_(ID_RLVHl1Uq/8vA0+9hyFiTRw)
Content-type: text/plain
Content-transfer-encoding: 7BIT

Dear sir,

I'd like to thank you this useful c++ library, which has help me a lot
to introduce to develop c++ in linux.

I've experienced some troubles with the class Thread, when implementing
a multithreading server. This server acts in the following manner:
1. Listen new incomming tcp connections.
2. Create a new thread to serve the request
3. This thread is activated and start running
4. The thread finish its executions and it is destroyed.

This method works rightly, at least for the first 1500 (more or less,
I'm not sure for the number)  incomming connections. After these, the
threads are created, but the method Thread.start() doesn't produce any
effect.

Here is a brief of my source code....

void Thread_Listener::run() {
        try {
                serverSocket = new TCPSocket (*ipAddres, tcpPort);
                 
                while (serverSocket->isPendingConnection()) {
                        thread_Service = new Thread_Service
(serverSocket);
                        thread_Service ->
start();                                                 // THIS IS THE
BUGGY LINE
                }
        }
        catch(Socket *socket) {
                <etc>
        }
}

void Thread_Service::run() {

        <Code for Executing
Request>                                                                           

        exit();
                                                                                                                             
}

Best Regards,

Borja Pacheco

--Boundary_(ID_RLVHl1Uq/8vA0+9hyFiTRw)
Content-type: text/html; charset=utf-8
Content-transfer-encoding: 7BIT

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
Dear sir,<BR>
<BR>
I'd like to thank you this useful c++ library, which has help me a lot to introduce to develop c++ in linux.<BR>
<BR>
I've experienced some troubles with the class Thread, when implementing a multithreading server. This server acts in the following manner:<BR>
1. Listen new incomming tcp connections.<BR>
2. Create a new thread to serve the request<BR>
3. This thread is activated and start running<BR>
4. The thread finish its executions and it is destroyed.<BR>
<BR>
This method works rightly, at least for the first 1500 (more or less, I'm not sure for the number)&nbsp; incomming connections. After these, the threads are created, but the method Thread.start() doesn't produce any effect.<BR>
<BR>
Here is a brief of my source code....<BR>
<BR>
void Thread_Listener::run() {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serverSocket = new TCPSocket (*ipAddres, tcpPort);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (serverSocket-&gt;isPendingConnection()) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thread_Service = new Thread_Service (serverSocket);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thread_Service -&gt; start();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // THIS IS THE BUGGY LINE<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(Socket *socket) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;etc&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
}<BR>
<BR>
void Thread_Service::run() {<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Code for Executing Request&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>
}<BR>
<BR>
Best Regards,<BR>
<BR>
Borja Pacheco
</BODY>
</HTML>

--Boundary_(ID_RLVHl1Uq/8vA0+9hyFiTRw)--



From MAILER-DAEMON Tue Nov 11 10:35:31 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AJaYF-0003B7-H5
	for mharc-bug-commoncpp@gnu.org; Tue, 11 Nov 2003 10:35:31 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AJaY7-00038w-D4
	for bug-commoncpp@gnu.org; Tue, 11 Nov 2003 10:35:23 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AJaXU-0002sr-1R
	for bug-commoncpp@gnu.org; Tue, 11 Nov 2003 10:35:15 -0500
Received: from [141.153.223.74] (helo=localhost.bayonne.dyndns.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.24) id 1AJaXT-0002sC-EN
	for bug-commoncpp@gnu.org; Tue, 11 Nov 2003 10:34:43 -0500
Received: from 192.168.1.103 ([192.168.1.103])
	by localhost.bayonne.dyndns.org (8.12.8/8.12.8) with ESMTP id
	hABGTe3Z002307; Tue, 11 Nov 2003 11:29:40 -0500
From: David Sugar <dyfet@ostel.com>
To: Borja Pacheco <borja.pacheco@amena.com>, bug-commoncpp@gnu.org
Date: Tue, 11 Nov 2003 09:45:25 -0500
User-Agent: KMail/1.5
References: <1068546110.1835.27.camel@blinux.red.isotrol.com>
In-Reply-To: <1068546110.1835.27.camel@blinux.red.isotrol.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200311110945.25648.dyfet@ostel.com>
Cc: 
Subject: Re: Thread activation bug
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 11 Nov 2003 15:35:26 -0000

Does the thread delete itself and have a "final" method implimented to do 
this?  Do you start the thread with "start()" or with "detach()".  If the 
thread is meant to be created and then run until it completes, followed by 
deleting itself, it needs to be started with "detach()", otherwise it will 
exit as an unjoined thread, and hence continue to use up a process or thread 
slot in the kernel process/thread tables even after exit.

On Tuesday 11 November 2003 05:21 am, Borja Pacheco wrote:
> Dear sir,
>
> I'd like to thank you this useful c++ library, which has help me a lot
> to introduce to develop c++ in linux.
>
> I've experienced some troubles with the class Thread, when implementing
> a multithreading server. This server acts in the following manner:
> 1. Listen new incomming tcp connections.
> 2. Create a new thread to serve the request
> 3. This thread is activated and start running
> 4. The thread finish its executions and it is destroyed.
>
> This method works rightly, at least for the first 1500 (more or less,
> I'm not sure for the number)  incomming connections. After these, the
> threads are created, but the method Thread.start() doesn't produce any
> effect.
>
> Here is a brief of my source code....
>
> void Thread_Listener::run() {
>         try {
>                 serverSocket = new TCPSocket (*ipAddres, tcpPort);
>
>                 while (serverSocket->isPendingConnection()) {
>                         thread_Service = new Thread_Service
> (serverSocket);
>                         thread_Service ->
> start();                                                 // THIS IS THE
> BUGGY LINE
>                 }
>         }
>         catch(Socket *socket) {
>                 <etc>
>         }
> }
>
> void Thread_Service::run() {
>
>         <Code for Executing
> Request>
>
>         exit();
>
> }
>
> Best Regards,
>
> Borja Pacheco




From MAILER-DAEMON Mon Nov 17 09:23:59 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1ALkII-0005Es-WB
	for mharc-bug-commoncpp@gnu.org; Mon, 17 Nov 2003 09:23:58 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1ALfr0-0005ny-Me
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 04:39:30 -0500
Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1ALfqz-0005nd-Js
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 04:39:29 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1ALeuQ-000465-Ib
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 03:39:29 -0500
Received: from [211.48.62.166] (helo=relay6.kornet.net)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1ALeuP-00045v-S1
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 03:38:58 -0500
Received: from [210.113.88.76] (hwyng02@kornet.net) by 
	relay6.kornet.net (Terrace MailWatcher) 
	with ESMTP id 2003111716:31:26:794842.6411.2026
	for <bug-commoncpp@gnu.org>; Mon, 17 Nov 2003 16:31:26 +0900 (KST) 
From: "Benjamin Y. Lee" <hwyng02@kornet.net>
To: <bug-commoncpp@gnu.org>
Date: Mon, 17 Nov 2003 16:31:07 +0900
Organization: Maple Design Automation
Message-ID: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAOzIEQTsK5UKLwUdtuspFxMKAAAAQAAAA6P/l4zU+g0axlBtqnnFwiwEAAAAA@kornet.net>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0005_01C3AD28.33F299A0"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.2627
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-TMDA-Confirmed: Mon Nov 17 04:39:29 EST 2003
X-Mailman-Approved-At: Mon, 17 Nov 2003 09:23:57 -0500
Subject: ccxx_tests were failed to pass in Redhat linux 9.0
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 17 Nov 2003 09:39:31 -0000

This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C3AD28.33F299A0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi !
 
I am using RedHat linux 9.0. I had downloaded Common C++ library version
2.1.0.13 and installed to /usr/local directory. When i tested installed
common C++ library using ccxx_tests, then any test was not passed.
 
  ...... T.T
 
For example, i want to use persistence related library routine. But the
results were wrong. Here is code example from SampelObject.cpp under
ccxx_tests.
 
   
void EngineTest::testComplexObject()
{
  // write BaseObject hierarchy
  std::fstream outputArchive("EngineComplexObjectTest.dat",
std::ios::out|std::ios::binary);
  Engine outputEngine(outputArchive, ost::Engine::modeWrite);
  outputEngine << complexObject;
  outputArchive.close();

    .....
 
In ddd debugger, when i executed "outputArchive.closed()" line and
examined "EngineComplexObjectTest.dat" in the shell, then it's file size
was zero.
 
   .....
 
I am trying to use common C++ library to write data persistently.
 
Thank you
 
>From Benjamin Y. Lee
 
======================================================================
 
 Benjamin Y. Lee, Ph.D
 
 Tel: +82-502-504-3016
 Email:  <mailto:hwyng02@kornet.net> hwyng02@kornet.net
 
======================================================================
 

------=_NextPart_000_0005_01C3AD28.33F299A0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>&#47700;&#49884;&#51648;</TITLE>

<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR></HEAD>
<BODY>
<DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>Hi =
!</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>I am using RedHat =
linux 9.0. I=20
had downloaded Common C++ library version 2.1.0.13 and installed to =
/usr/local=20
directory. When i tested installed common C++ library using ccxx_tests, =
then any=20
test was not passed.</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>&nbsp; ......=20
T.T</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>For example, i want =
to use=20
persistence related&nbsp;library routine. But the results were wrong. =
Here is=20
code example from SampelObject.cpp under ccxx_tests.</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>&nbsp;&nbsp; =
<BR>void=20
EngineTest::testComplexObject()<BR>{<BR>&nbsp; // write BaseObject=20
hierarchy<BR>&nbsp; std::fstream =
outputArchive("EngineComplexObjectTest.dat",=20
std::ios::out|std::ios::binary);<BR>&nbsp; Engine =
outputEngine(outputArchive,=20
ost::Engine::modeWrite);<BR>&nbsp; outputEngine &lt;&lt;=20
complexObject;<BR>&nbsp; outputArchive.close();<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>&nbsp;&nbsp;&nbsp;=20
.....</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>In ddd debugger, =
when i=20
executed "outputArchive.closed()" line and examined=20
"EngineComplexObjectTest.dat" in the shell, then it's file size was=20
zero.</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>&nbsp;&nbsp;=20
.....</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>I am trying to use =
common C++=20
library to write data&nbsp;<SPAN=20
class=3D684482807-17112003>persistently</SPAN>.</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>Thank =
you</FONT></SPAN></DIV>
<DIV><SPAN class=3D340081407-17112003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D340081407-17112003><FONT size=3D2>From Benjamin Y.=20
Lee</FONT></DIV></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV align=3Dleft>
<DIV align=3Dleft><SPAN class=3D402533401-03092003><FONT=20
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FO=
NT></SPAN></DIV>
<DIV><SPAN class=3D402533401-03092003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D402533401-03092003><FONT size=3D2>&nbsp;Benjamin Y. =
Lee,=20
Ph.D</FONT></SPAN></DIV>
<DIV><SPAN class=3D402533401-03092003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D402533401-03092003><SPAN =
class=3D833321300-07112003><FONT=20
size=3D2>&nbsp;</FONT></SPAN></SPAN><SPAN =
class=3D402533401-03092003><FONT=20
size=3D2><SPAN class=3D833321300-07112003>Tel</SPAN>:=20
+82-502-504-3016</FONT></SPAN></DIV>
<DIV><SPAN class=3D402533401-03092003><FONT =
size=3D2>&nbsp;</FONT></SPAN><SPAN=20
class=3D402533401-03092003><FONT size=3D2>Email: </FONT><A=20
href=3D"mailto:hwyng02@kornet.net"><FONT=20
size=3D2>hwyng02@kornet.net</FONT></A></SPAN></DIV>
<DIV><SPAN class=3D402533401-03092003><FONT =
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D402533401-03092003>
<DIV><SPAN class=3D402533401-03092003><FONT=20
size=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FO=
NT></SPAN><SPAN=20
class=3D402533401-03092003></DIV></SPAN></SPAN></DIV></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0005_01C3AD28.33F299A0--






From MAILER-DAEMON Mon Nov 17 21:19:32 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1ALvSl-0000ro-U0
	for mharc-bug-commoncpp@gnu.org; Mon, 17 Nov 2003 21:19:31 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1ALvSg-0000kT-Ru
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 21:19:26 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1ALvS7-0000Pd-Bp
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 21:19:23 -0500
Received: from [69.19.166.25] (helo=o1-smfcorpmail.o1.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1ALvS7-0000Pa-1a
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 21:18:51 -0500
Received: from mail.o1.com ([10.10.11.67]) by o1-smfcorpmail.o1.com with
	Microsoft SMTPSVC(5.0.2195.6713); Mon, 17 Nov 2003 17:19:18 -0800
From: Matt Scifo <mscifo@o1.com>
To: bug-commoncpp@gnu.org
Content-Type: text/plain
Message-Id: <1069118138.20987.192.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Mon, 17 Nov 2003 17:15:38 -0800
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 18 Nov 2003 01:19:18.0296 (UTC)
	FILETIME=[FCEF5980:01C3AD71]
Subject: Use of Thread::Cancel
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Nov 2003 02:19:29 -0000

Hello

I am having some problems understanding exactly how to cancel a thread.

I want to be able to issue a cancel request to a thread from another
thread (not a parent) and have it cancel only if it has not reached  a
certain execution point.  If that point has been reached, then the
cancel shouldn't be performed until a set point.

The docs talk about using cancelDeferred and setting a cancellation
point "such as yield".  I'm not quite sure how to set a specific
cancellation point.

Here is some exmaple code that shows what I am trying to do...

while(!stop_running)
{
    if (!_module_queue->empty())
    {
        void *target;
        // _module_queue is a class derived from Buffer.
        // This call blocks until something has been posted
        // to the queue.
        //
        // Do not cancel beyond this point until cancellation
        // point has been reached!
        _module_queue->wait(&target);

        while(start_important_operations_with_target)
        {
            // do not process a cancel() request until this
            // block finishes.
        }

        // set cancellation point here.
        // cancel() can now take affect.
    }
}


Can anyone offer any insight?

I am using RH9, g++ 2.9.6, and commoncpp2 v1.0.13.

Thanks

Matt Scifo




From MAILER-DAEMON Mon Nov 17 22:23:13 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1ALwSO-0008Mp-Rs
	for mharc-bug-commoncpp@gnu.org; Mon, 17 Nov 2003 22:23:12 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1ALwSM-0008Mg-Vz
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 22:23:10 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1ALwRq-0008A2-1d
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 22:23:09 -0500
Received: from [141.153.146.157] (helo=localhost.bayonne.dyndns.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.24) id 1ALwRn-00089y-Tr
	for bug-commoncpp@gnu.org; Mon, 17 Nov 2003 22:22:36 -0500
Received: from 192.168.1.103 ([192.168.1.103])
	by localhost.bayonne.dyndns.org (8.12.8/8.12.8) with ESMTP id
	hAI4IT3Z021377; Mon, 17 Nov 2003 23:18:29 -0500
From: David Sugar <dyfet@ostel.com>
To: Matt Scifo <mscifo@o1.com>, bug-commoncpp@gnu.org
Date: Mon, 17 Nov 2003 21:34:14 -0500
User-Agent: KMail/1.5.3
References: <1069118138.20987.192.camel@localhost>
In-Reply-To: <1069118138.20987.192.camel@localhost>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200311172134.14873.dyfet@ostel.com>
Cc: 
Subject: Re: Use of Thread::Cancel
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Nov 2003 03:23:11 -0000

"cancellation points" is a concept that exists in posix threading (pthreads).  
The idea is that specific calls or functions will act as a cancellation 
point, and these are defined typically as the sleep and yield call, a 
semaphore call, and a wait on a conditional object.

Posix threads can be set to cancel either always, which may be bad, if, for 
example, a cancel request happens in the middle of an action that allocates 
or manipulates a system resource, at the stated cancellation points, or 
never.  This is why cancellation points are useful, you can use them to make 
sure that at other times your thread will execute and operations will 
complete without interruption.

Cancellation does not depend on a parent-child relationship because posix 
threads has no such concept, rather any thread can already join any other 
thread, unless a thread has been explicitly "detached", in which case no 
thread can cancel (join) it.

Common C++ uses parent-child thread relationships as a convenience for thread 
death notification.  That is, a Common C++ thread object is aware of the 
thread context of the thread it was created from.  This could be useful for 
applications which wish to maintain such relationships, but in no way effects 
cancellation.

Cancellation can be simulated in w32 with the addition of an additional object 
placed in artificially extended and alternate sleep, yield, and semaphore 
functions, and the w32 port of Common C++ does this to simulate posix 
behavior.

Here is an example of a loop where setCancel may be used:


	for(;;)
	{
		failover();
		setCancel(cancelImmediate);
		time(&now);
		if(now >= last + refresh)
		{
			if(nodes > 1)
				elect();
			...	some other operations that may be interrupted
		}

		setCancel(cancelDeferred);

		// file operations are cancellation points...
		rtn = ::recvfrom(so, buffer, sizeof(node), 0,
			(struct sockaddr *)&addr, &alen);
		if(rtn < 1)
		{
			slog(Slog::levelWarning) << "network: input error..." << rtn << endl;
			// so is sleep
			Thread::sleep(5000);
			continue;

The idea being you can use setCancel(cancelImmediate) to mark a section of 
code that you do not care if it is interrupted, such as a tight for loop that 
you dont want to waste a yield on but does not do any system operation.



On Monday 17 November 2003 08:15 pm, Matt Scifo wrote:
> Hello
>
> I am having some problems understanding exactly how to cancel a thread.
>
> I want to be able to issue a cancel request to a thread from another
> thread (not a parent) and have it cancel only if it has not reached  a
> certain execution point.  If that point has been reached, then the
> cancel shouldn't be performed until a set point.
>
> The docs talk about using cancelDeferred and setting a cancellation
> point "such as yield".  I'm not quite sure how to set a specific
> cancellation point.
>
> Here is some exmaple code that shows what I am trying to do...
>
> while(!stop_running)
> {
>     if (!_module_queue->empty())
>     {
>         void *target;
>         // _module_queue is a class derived from Buffer.
>         // This call blocks until something has been posted
>         // to the queue.
>         //
>         // Do not cancel beyond this point until cancellation
>         // point has been reached!
>         _module_queue->wait(&target);
>
>         while(start_important_operations_with_target)
>         {
>             // do not process a cancel() request until this
>             // block finishes.
>         }
>
>         // set cancellation point here.
>         // cancel() can now take affect.
>     }
> }
>
>
> Can anyone offer any insight?
>
> I am using RH9, g++ 2.9.6, and commoncpp2 v1.0.13.
>
> Thanks
>
> Matt Scifo
>
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp




From MAILER-DAEMON Tue Nov 18 13:37:32 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMAjE-0002rw-Jl
	for mharc-bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:37:32 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMAiK-0002Wd-Vy
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:36:36 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMAhf-0001wt-Ne
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:36:27 -0500
Received: from [69.19.166.25] (helo=o1-smfcorpmail.o1.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMAh7-00012u-7W
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:35:21 -0500
Received: from mail.o1.com ([10.10.11.67]) by o1-smfcorpmail.o1.com with
	Microsoft SMTPSVC(5.0.2195.6713); Tue, 18 Nov 2003 09:35:50 -0800
From: Matt Scifo <mscifo@o1.com>
To: David Sugar <dyfet@ostel.com>
In-Reply-To: <200311172134.14873.dyfet@ostel.com>
References: <1069118138.20987.192.camel@localhost>
	<200311172134.14873.dyfet@ostel.com>
Content-Type: text/plain
Message-Id: <1069176728.20987.208.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Tue, 18 Nov 2003 09:32:08 -0800
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 18 Nov 2003 17:35:50.0093 (UTC)
	FILETIME=[685E0FD0:01C3ADFA]
Cc: bug-commoncpp@gnu.org
Subject: Re: Use of Thread::Cancel
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Nov 2003 18:37:31 -0000

David

I'm still a little sketchy on the use of cancellation points,
specifically using a yield or sleep call, something I prefer not to do
because performance time is a big factor in my requirements.  Thank you
for the extended explanation of the cancellation concept.  The detail
along with what I understood from reading the docs helped me to explain
the concept.  It's just the implementation that still causes me
confusion.

Below I have amended my original example to make use of your example. 
Please let me know if I am doing this right.

setCancel(cancelImmediate);
while(!stop_running)
{
    if (!_module_queue->empty())
    {
        void *target;
        // _module_queue is a class derived from Buffer.
        // This call blocks until something has been posted
        // to the queue.
        //
        // Do not cancel beyond this point until cancellation
        // point has been reached!
        _module_queue->wait(&target);

        setCancel(cancelDeferred);
        while(start_important_operations_with_target)
        {
            // do not process a cancel() request until this
            // block finishes.

            // after everything important finishes, do 
            // yield() or sleep()?
            // i want this to have very little impact on the
            // running time.
	     Thread::sleep(1);  // sleep 1 microsecond
            // this sleep call should tell the thread to cancel?
        }

        // set cancellation point here.
        // cancel() can now take affect.
        setCancel(cancelImmediate);
    }
}

This also brought up a couple other concerns...

1)  How exactly do I cancel a thread from another thread?  There doesn't
seem to be a cancel() method.  The terminate() method is available, but
only to parent objects as a protected method.  I need to be able to stop
a thread from another thread that isn't the parent.

2)  Will the thread process a request to stop it even though it is
blocking on a semaphore wait() call, part of the Buffer class? 


Thanks again for your fast response.

Matt

On Mon, 2003-11-17 at 18:34, David Sugar wrote:
> "cancellation points" is a concept that exists in posix threading (pthreads).  
> The idea is that specific calls or functions will act as a cancellation 
> point, and these are defined typically as the sleep and yield call, a 
> semaphore call, and a wait on a conditional object.
> 
> Posix threads can be set to cancel either always, which may be bad, if, for 
> example, a cancel request happens in the middle of an action that allocates 
> or manipulates a system resource, at the stated cancellation points, or 
> never.  This is why cancellation points are useful, you can use them to make 
> sure that at other times your thread will execute and operations will 
> complete without interruption.
> 
> Cancellation does not depend on a parent-child relationship because posix 
> threads has no such concept, rather any thread can already join any other 
> thread, unless a thread has been explicitly "detached", in which case no 
> thread can cancel (join) it.
> 
> Common C++ uses parent-child thread relationships as a convenience for thread 
> death notification.  That is, a Common C++ thread object is aware of the 
> thread context of the thread it was created from.  This could be useful for 
> applications which wish to maintain such relationships, but in no way effects 
> cancellation.
> 
> Cancellation can be simulated in w32 with the addition of an additional object 
> placed in artificially extended and alternate sleep, yield, and semaphore 
> functions, and the w32 port of Common C++ does this to simulate posix 
> behavior.
> 
> Here is an example of a loop where setCancel may be used:
> 
> 
> 	for(;;)
> 	{
> 		failover();
> 		setCancel(cancelImmediate);
> 		time(&now);
> 		if(now >= last + refresh)
> 		{
> 			if(nodes > 1)
> 				elect();
> 			...	some other operations that may be interrupted
> 		}
> 
> 		setCancel(cancelDeferred);
> 
> 		// file operations are cancellation points...
> 		rtn = ::recvfrom(so, buffer, sizeof(node), 0,
> 			(struct sockaddr *)&addr, &alen);
> 		if(rtn < 1)
> 		{
> 			slog(Slog::levelWarning) << "network: input error..." << rtn << endl;
> 			// so is sleep
> 			Thread::sleep(5000);
> 			continue;
> 
> The idea being you can use setCancel(cancelImmediate) to mark a section of 
> code that you do not care if it is interrupted, such as a tight for loop that 
> you dont want to waste a yield on but does not do any system operation.
> 
> 
> 
> On Monday 17 November 2003 08:15 pm, Matt Scifo wrote:
> > Hello
> >
> > I am having some problems understanding exactly how to cancel a thread.
> >
> > I want to be able to issue a cancel request to a thread from another
> > thread (not a parent) and have it cancel only if it has not reached  a
> > certain execution point.  If that point has been reached, then the
> > cancel shouldn't be performed until a set point.
> >
> > The docs talk about using cancelDeferred and setting a cancellation
> > point "such as yield".  I'm not quite sure how to set a specific
> > cancellation point.
> >
> > Here is some exmaple code that shows what I am trying to do...
> >
> > while(!stop_running)
> > {
> >     if (!_module_queue->empty())
> >     {
> >         void *target;
> >         // _module_queue is a class derived from Buffer.
> >         // This call blocks until something has been posted
> >         // to the queue.
> >         //
> >         // Do not cancel beyond this point until cancellation
> >         // point has been reached!
> >         _module_queue->wait(&target);
> >
> >         while(start_important_operations_with_target)
> >         {
> >             // do not process a cancel() request until this
> >             // block finishes.
> >         }
> >
> >         // set cancellation point here.
> >         // cancel() can now take affect.
> >     }
> > }
> >
> >
> > Can anyone offer any insight?
> >
> > I am using RH9, g++ 2.9.6, and commoncpp2 v1.0.13.
> >
> > Thanks
> >
> > Matt Scifo
> >
> >
> >
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> 




From MAILER-DAEMON Tue Nov 18 13:50:40 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMAvv-0005fF-Ap
	for mharc-bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:50:39 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMAvs-0005dW-04
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:50:36 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMAvL-0005RJ-Ey
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:50:34 -0500
Received: from [69.19.166.25] (helo=o1-smfcorpmail.o1.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMAvK-0005Qa-HJ
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 13:50:02 -0500
Received: from mail.o1.com ([10.10.11.67]) by o1-smfcorpmail.o1.com with
	Microsoft SMTPSVC(5.0.2195.6713); Tue, 18 Nov 2003 09:50:23 -0800
From: Matt Scifo <mscifo@o1.com>
To: deshmua@mail.ececs.uc.edu
In-Reply-To: <1069174210.3fba4dc29e6db@webmail.uc.edu>
References: <1069118138.20987.192.camel@localhost>
	<1069174210.3fba4dc29e6db@webmail.uc.edu>
Content-Type: text/plain
Message-Id: <1069177602.20990.223.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Tue, 18 Nov 2003 09:46:42 -0800
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 18 Nov 2003 17:50:23.0890 (UTC)
	FILETIME=[7130E720:01C3ADFC]
Cc: bug-commoncpp@gnu.org
Subject: Re: Use of Thread::Cancel
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Nov 2003 18:50:37 -0000

Amol, 

Thanks for your suggestion.  Actually, I am already making use of an
object level "flag" variable to determine whether or not the thread
should continue running.  That flag is shown in my example code as
"stopRunning".  As you pointed out, that flag will only allow me to
check to see if the thread should internally terminate at specific
points where I check for it.  I agree that cluttering up my code with
these checks is not desirable.  

Signals are the next logical direction to achieve my goals.  I have
already implemented a main signal handler in my primary thread.  Being
this is C++ and my signal handlers must be non-class functions, I end up
using a global "flag" variable again.  My main thread checks for this
variable the same way I discussed above and then performs the necessary
class method calls to shutdown other threads.  

My application launches a dynamic number of threads usually in the
hundreds to thousands range and I'm not sure if creating a signal
handler for each individual thread is the best way to accomplish my
task.  If I only want to terminate say 100 threads, how would I send a
specific signal to a certain 100 threads?

Can you or anyone else offer any insight about this possibility? 

Thanks

Matt

On Tue, 2003-11-18 at 08:50, deshmua@mail.ececs.uc.edu wrote:
> Hi Matt,
> 
> It seems to me that your problem might be solved by simply 
> setting a "cancelFlag" in your thread class. 
> 
> The resulting code would be something like this:
> (inserted code marked by //**)
> 
> -------------------------code----------------------
> //**declare some object level flag here: short cancelThread=1;
> 
>  while(!stop_running)
>  {
>      if (!_module_queue->empty())
>      {
>          void *target;
>          // _module_queue is a class derived from Buffer.
>          // This call blocks until something has been posted
>          // to the queue.
> 
>          //**check for cancellation here
>          if (cancelThread>0) return;  //**
> 
>          //
>          // Do not cancel beyond this point until cancellation
>          // point has been reached!
>          _module_queue->wait(&target);
>  
>         while(start_important_operations_with_target)
>          {
>              // do not process a cancel() request until this
>              // block finishes.
>          }
> 
>          //**check for cancellation here
>          if (cancelThread>0) return;  //** 
> 
>          // set cancellation point here.
>          // cancel() can now take affect.
>      }
>  }
> -------------------------------end code---------------------
> but this would allow you to check for cancellation only at 
> specific instants in your code. If you want a truly 
> asynchronous cancellation you would have to use signals which
> dont seem to supported in the GNU common CPP package. You would
> have to use C signal handlers (which are surprisingly easy to 
> write). If you need outline of code using signal handler, let
> me know.
> 
> Regards,
> ~ amol
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Quoting Matt Scifo <mscifo@o1.com>:
> 
> > Hello
> > 
> > I am having some problems understanding exactly how to cancel a
> > thread.
> > 
> > I want to be able to issue a cancel request to a thread from another
> > thread (not a parent) and have it cancel only if it has not reached  a
> > certain execution point.  If that point has been reached, then the
> > cancel shouldn't be performed until a set point.
> > 
> > The docs talk about using cancelDeferred and setting a cancellation
> > point "such as yield".  I'm not quite sure how to set a specific
> > cancellation point.
> > 
> > Here is some exmaple code that shows what I am trying to do...
> > 
> > while(!stop_running)
> > {
> >     if (!_module_queue->empty())
> >     {
> >         void *target;
> >         // _module_queue is a class derived from Buffer.
> >         // This call blocks until something has been posted
> >         // to the queue.
> >         //
> >         // Do not cancel beyond this point until cancellation
> >         // point has been reached!
> >         _module_queue->wait(&target);
> > 
> >         while(start_important_operations_with_target)
> >         {
> >             // do not process a cancel() request until this
> >             // block finishes.
> >         }
> > 
> >         // set cancellation point here.
> >         // cancel() can now take affect.
> >     }
> > }
> > 
> > 
> > Can anyone offer any insight?
> > 
> > I am using RH9, g++ 2.9.6, and commoncpp2 v1.0.13.
> > 
> > Thanks
> > 
> > Matt Scifo
> > 
> > 
> > 
> > _______________________________________________
> > Bug-commoncpp mailing list
> > Bug-commoncpp@gnu.org
> > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> > 




From MAILER-DAEMON Tue Nov 18 16:12:24 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMD95-00067k-Nc
	for mharc-bug-commoncpp@gnu.org; Tue, 18 Nov 2003 16:12:23 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMD92-000635-64
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 16:12:20 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMD8R-0005gu-0h
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 16:12:14 -0500
Received: from [69.19.166.25] (helo=o1-smfcorpmail.o1.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMD8Q-0005gk-NY
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 16:11:42 -0500
Received: from mail.o1.com ([10.10.11.67]) by o1-smfcorpmail.o1.com with
	Microsoft SMTPSVC(5.0.2195.6713); Tue, 18 Nov 2003 12:12:11 -0800
From: Matt Scifo <mscifo@o1.com>
To: deshmua@mail.ececs.uc.edu
In-Reply-To: <1069188688.3fba8650e8b6d@webmail.uc.edu>
References: <1069118138.20987.192.camel@localhost>
	<1069174210.3fba4dc29e6db@webmail.uc.edu>
	<1069177602.20990.223.camel@localhost>
	<1069188688.3fba8650e8b6d@webmail.uc.edu>
Content-Type: text/plain
Message-Id: <1069186109.20989.232.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Tue, 18 Nov 2003 12:08:29 -0800
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 18 Nov 2003 20:12:11.0687 (UTC)
	FILETIME=[403BB370:01C3AE10]
Cc: bug-commoncpp@gnu.org
Subject: Re: Use of Thread::Cancel
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Nov 2003 21:12:21 -0000

On Tue, 2003-11-18 at 12:51, deshmua@mail.ececs.uc.edu wrote:
> Hi,
> 
> Just a couple of points:
> 1. Is it true that pthread library on Linux creates separate
> processes for individual threads? In that case could a system
> scale with 1000s of threads on Linux? (Can someone confirm this?)
> Also in that case wouldnt any thread interrupt mechanism require
> to use signals in the implementation? (Again, can someone confirm
> this?)
> 
I'm already running successfully with thousands of threads.  The only
issue I came across was having to tune my thread stack size to ensure
that I had enough memory to launch all the threads.

$ulimit -s -u
stack size            (kbytes, -s) 8192
max user processes            (-u) 7168


> 2. Also if its not too late you may want to take a look at ACE
> which has c++ wrappers for threads as well. The ACE wrappers are
> supposed to be more 'evolved' and platform independent. The 
> installation is huge though and learning curve may be steeper
> than for GNU Common CPP.
> ACE_Threads have methods like cancel, disableCancel, enableCancel
> that may be suitable for your purpose. Again, I dont know much
> about the underlying implementation (and the documentation is terse)
> 

I'll look into this.  My application only uses the commoncpp threads
implementation and the Buffer class (which I just stopped using because
it didn't implement a timed wait or immediately returnable wait).  I do
however like the fact that commoncpp has many classes and I was thinking
of utilizing more of them as my application matured, specifically the
socket classes.

Thanks

Matt




From MAILER-DAEMON Tue Nov 18 22:17:47 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMIqh-0008C0-6V
	for mharc-bug-commoncpp@gnu.org; Tue, 18 Nov 2003 22:17:47 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMCZq-0002ZR-Il
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 15:35:58 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMCZJ-0002NX-Fy
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 15:35:56 -0500
Received: from [129.137.2.128] (helo=webmail.uc.edu)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMCZI-0002Mv-UJ
	for bug-commoncpp@gnu.org; Tue, 18 Nov 2003 15:35:24 -0500
Received: (from apache@localhost)
	by webmail.uc.edu (8.11.6/8.11.6) id hAIKpS902291;
	Tue, 18 Nov 2003 15:51:28 -0500
X-Authentication-Warning: webmail.uc.edu: apache set sender to
	deshmua@mail.ececs.uc.edu using -f
To: Matt Scifo <mscifo@o1.com>
Message-ID: <1069188688.3fba8650e8b6d@webmail.uc.edu>
Date: Tue, 18 Nov 2003 15:51:28 -0500 (EST)
From: deshmua@mail.ececs.uc.edu
References: <1069118138.20987.192.camel@localhost>
	<1069174210.3fba4dc29e6db@webmail.uc.edu>
	<1069177602.20990.223.camel@localhost>
In-Reply-To: <1069177602.20990.223.camel@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: IMP/PHP IMAP webmail program 2.2.7
X-Originating-IP: 10.63.7.155
X-Mailman-Approved-At: Tue, 18 Nov 2003 22:17:44 -0500
Cc: bug-commoncpp@gnu.org
Subject: Re: Use of Thread::Cancel
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Nov 2003 20:35:59 -0000

Hi,

Just a couple of points:
1. Is it true that pthread library on Linux creates separate
processes for individual threads? In that case could a system
scale with 1000s of threads on Linux? (Can someone confirm this?)
Also in that case wouldnt any thread interrupt mechanism require
to use signals in the implementation? (Again, can someone confirm
this?)

2. Also if its not too late you may want to take a look at ACE
which has c++ wrappers for threads as well. The ACE wrappers are
supposed to be more 'evolved' and platform independent. The 
installation is huge though and learning curve may be steeper
than for GNU Common CPP.
ACE_Threads have methods like cancel, disableCancel, enableCancel
that may be suitable for your purpose. Again, I dont know much
about the underlying implementation (and the documentation is terse)

Hope that helps,
Regards,
~ amol

Quoting Matt Scifo <mscifo@o1.com>:

> Amol, 
> 
> Thanks for your suggestion.  Actually, I am already making use of an
> object level "flag" variable to determine whether or not the thread
> should continue running.  That flag is shown in my example code as
> "stopRunning".  As you pointed out, that flag will only allow me to
> check to see if the thread should internally terminate at specific
> points where I check for it.  I agree that cluttering up my code with
> these checks is not desirable.  
> 
> Signals are the next logical direction to achieve my goals.  I have
> already implemented a main signal handler in my primary thread.  Being
> this is C++ and my signal handlers must be non-class functions, I end
> up
> using a global "flag" variable again.  My main thread checks for this
> variable the same way I discussed above and then performs the
> necessary
> class method calls to shutdown other threads.  
> 
> My application launches a dynamic number of threads usually in the
> hundreds to thousands range and I'm not sure if creating a signal
> handler for each individual thread is the best way to accomplish my
> task.  If I only want to terminate say 100 threads, how would I send a
> specific signal to a certain 100 threads?
> 
> Can you or anyone else offer any insight about this possibility? 
> 
> Thanks
> 
> Matt
> 
> On Tue, 2003-11-18 at 08:50, deshmua@mail.ececs.uc.edu wrote:
> > Hi Matt,
> > 
> > It seems to me that your problem might be solved by simply 
> > setting a "cancelFlag" in your thread class. 
> > 
> > The resulting code would be something like this:
> > (inserted code marked by //**)
> > 
> > -------------------------code----------------------
> > //**declare some object level flag here: short cancelThread=1;
> > 
> >  while(!stop_running)
> >  {
> >      if (!_module_queue->empty())
> >      {
> >          void *target;
> >          // _module_queue is a class derived from Buffer.
> >          // This call blocks until something has been posted
> >          // to the queue.
> > 
> >          //**check for cancellation here
> >          if (cancelThread>0) return;  //**
> > 
> >          //
> >          // Do not cancel beyond this point until cancellation
> >          // point has been reached!
> >          _module_queue->wait(&target);
> >  
> >         while(start_important_operations_with_target)
> >          {
> >              // do not process a cancel() request until this
> >              // block finishes.
> >          }
> > 
> >          //**check for cancellation here
> >          if (cancelThread>0) return;  //** 
> > 
> >          // set cancellation point here.
> >          // cancel() can now take affect.
> >      }
> >  }
> > -------------------------------end code---------------------
> > but this would allow you to check for cancellation only at 
> > specific instants in your code. If you want a truly 
> > asynchronous cancellation you would have to use signals which
> > dont seem to supported in the GNU common CPP package. You would
> > have to use C signal handlers (which are surprisingly easy to 
> > write). If you need outline of code using signal handler, let
> > me know.
> > 
> > Regards,
> > ~ amol
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Quoting Matt Scifo <mscifo@o1.com>:
> > 
> > > Hello
> > > 
> > > I am having some problems understanding exactly how to cancel a
> > > thread.
> > > 
> > > I want to be able to issue a cancel request to a thread from
> another
> > > thread (not a parent) and have it cancel only if it has not reached 
> a
> > > certain execution point.  If that point has been reached, then the
> > > cancel shouldn't be performed until a set point.
> > > 
> > > The docs talk about using cancelDeferred and setting a
> cancellation
> > > point "such as yield".  I'm not quite sure how to set a specific
> > > cancellation point.
> > > 
> > > Here is some exmaple code that shows what I am trying to do...
> > > 
> > > while(!stop_running)
> > > {
> > >     if (!_module_queue->empty())
> > >     {
> > >         void *target;
> > >         // _module_queue is a class derived from Buffer.
> > >         // This call blocks until something has been posted
> > >         // to the queue.
> > >         //
> > >         // Do not cancel beyond this point until cancellation
> > >         // point has been reached!
> > >         _module_queue->wait(&target);
> > > 
> > >         while(start_important_operations_with_target)
> > >         {
> > >             // do not process a cancel() request until this
> > >             // block finishes.
> > >         }
> > > 
> > >         // set cancellation point here.
> > >         // cancel() can now take affect.
> > >     }
> > > }
> > > 
> > > 
> > > Can anyone offer any insight?
> > > 
> > > I am using RH9, g++ 2.9.6, and commoncpp2 v1.0.13.
> > > 
> > > Thanks
> > > 
> > > Matt Scifo
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > Bug-commoncpp mailing list
> > > Bug-commoncpp@gnu.org
> > > http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> > > 
> 
> 
> 
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp
> 



From MAILER-DAEMON Wed Nov 19 11:22:54 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMUzi-0000BB-Aq
	for mharc-bug-commoncpp@gnu.org; Wed, 19 Nov 2003 11:15:54 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMUYv-0005XF-O7
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 10:48:13 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMUVM-0003pC-Hp
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 10:45:05 -0500
Received: from [213.56.76.234] (helo=mh2.cvf.fr)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.24) id 1AMUV8-0003Ls-6c
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 10:44:18 -0500
Received: from [10.33.99.113] (helo=ms.int33.cvf) by mh2.cvf.fr with esmtp 
	for <bug-commoncpp@gnu.org>id 1AMTXR-0006HE-00;
	Wed, 19 Nov 2003 15:42:37 +0100
Received: from [127.0.0.1] (helo=ferrari.dev33.cvf)
	by ms.int33.cvf with esmtp id 1AMTXb-0005CA-00
	for <bug-commoncpp@gnu.org>; Wed, 19 Nov 2003 15:42:47 +0100
From: Christophe Mesplede <cmesplede@cvf.fr>
To: bug-commoncpp@gnu.org
Content-Type: text/plain
Message-Id: <1069252967.3889.106.camel@ferrari.dev33.cvf>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Wed, 19 Nov 2003 15:42:47 +0100
Content-Transfer-Encoding: 7bit
X-complaints-to: abuse@cvf.fr
X-Mailman-Approved-At: Wed, 19 Nov 2003 11:15:52 -0500
Subject: lines truncated tp 128 chars in Slog
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 19 Nov 2003 15:48:14 -0000

Hi.

I'm using slog and I noticed lines are truncated to 128 chars.

After some investigations, I found this is due to the declaration of
"char _msgbuf[128];" of the class ThreadImpl in <private.h>.

I think this should be fixed in order to allow the use of long lines. I
think the syslog spec allows up to 1024 chars, but I'm not sure, I'll
let you find this out :-)

Have a nice day,

-- 
Christophe Mesplede - CVF Bordeaux
Software Engineer
Office +33(0)5.56.01.98.00    Fax +33(0)5.56.01.98.01
Mobile +33(0)6.63.14.26.20    E-Mail cmesplede@cvf.fr




From MAILER-DAEMON Wed Nov 19 16:33:04 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMZwe-0004YO-01
	for mharc-bug-commoncpp@gnu.org; Wed, 19 Nov 2003 16:33:04 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMZwZ-0004Wt-VQ
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 16:33:00 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMZw0-0004L1-0u
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 16:32:55 -0500
Received: from [69.19.166.25] (helo=o1-smfcorpmail.o1.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMZvz-0004K5-94
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 16:32:23 -0500
Received: from mail.o1.com ([10.10.11.67]) by o1-smfcorpmail.o1.com with
	Microsoft SMTPSVC(5.0.2195.6713); Wed, 19 Nov 2003 12:32:52 -0800
From: Matt Scifo <mscifo@o1.com>
To: bug-commoncpp@gnu.org
Content-Type: text/plain
Message-Id: <1069273747.20990.283.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Wed, 19 Nov 2003 12:29:07 -0800
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 19 Nov 2003 20:32:52.0078 (UTC)
	FILETIME=[4DFA18E0:01C3AEDC]
Subject: Thread::isRunning() returning false even though thread hasn't
	fully terminated
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 19 Nov 2003 21:33:01 -0000

Hello

I have a list of pointers to Thread objects.

list< Thread * > instances;

When it comes time to terminate my threads, I have a for loop iterate
over the list and call destroy_instance().  destroy_instance() sets a
termination flag that is being checked for in the thread's run() method.

    for (list< Thread * >::iterator it = instances.begin(); it !=
instances.end(); it++)
    {
        cout << "Terminating " << name << " thread." << endl;
        destroy_instance((*it));
    }

Now all threads have been told to terminate and are finishing their
operations until they come to the check point and see that they have
been told to exit the run() method.

To ensure that I don't proceed until all my threads have terminated, I
continue to iterate through the list of threads, checking if they are
still running.  If isRunning() returns false, then I delete the thread
object, remove it from the list, and repeat the iteration until all
threads return false on isRunning() and they have been deleted.

    while (instances.size() > 0)
    {
        for (list< Thread * >::iterator it = instances.begin(); it !=
instances.end(); it++)
        {
            if (!(*it)->isRunning())
            {
                cout << "Deleting " << name << " instance." << endl;
                delete (*it);
                instances.erase(it);
                cout << instances.size() << " threads remaining.\n";
                break;
            }
        }
    }


I am debugging in GDB and receive a message when each thread exits...
[Thread -1214117072 (zombie) exited]

This indicates that the thread has finished but the object has yet to be
deleted.

The problem I am facing is that I am receiving notification from GDB
that the threads are exiting after I have already deleted them.  Why is
Thread::isRunning() reporting that the thread is not running when in
fact GDB shows that the thread hasn't actually terminated yet?

Output from running in GDB...
<snip>
Terminating MyThread thread.
Terminating MyThread thread.
Terminating MyThread thread.
Terminating MyThread thread.
Terminating MyThread thread.
Terminating MyThread thread.
Terminating MyThread thread.

MyThread::final() called
MyThread::final() called
MyThread::final() called
MyThread::final() called
MyThread::final() called
MyThread::final() called
MyThread::final() called

Deleting MyThread instance.
MyThread::~MyThread called
6 threads remaining.
Deleting MyThread instance.
MyThread::~MyThread called
5 threads remaining.
Deleting MyThread instance.
MyThread::~MyThread called
4 threads remaining.
Deleting MyThread instance.
MyThread::~MyThread called
3 threads remaining.
Deleting MyThread instance.
MyThread::~MyThread called
2 threads remaining.
Deleting MyThread instance.
MyThread::~MyThread called
1 threads remaining.
Deleting MyThread instance.
MyThread::~MyThread called
0 threads remaining.

/*  
   At this point, all thread objects have been successfully deleted.
   Why do they only begin to actually terminate until after the    
   objects have deleted.  If isRunning() is not supposed to tell me 
   when the thread truly stops, then I need something that can.
*/

[Thread 1167313712 (zombie) exited]
[Thread 1805159216 (zombie) exited]
[Thread 1226062640 (zombie) exited]
[Thread 1544985392 (zombie) exited]
[Thread 1419094832 (zombie) exited]
[Thread 1234455344 (zombie) exited]
[Thread 1242848048 (zombie) exited]
</snip>

RH9, g++ 2.9.6, commoncpp2 1.0.13

Can anyone please explain?


Matt Scifo






From MAILER-DAEMON Wed Nov 19 22:00:01 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMf32-0001oo-SI
	for mharc-bug-commoncpp@gnu.org; Wed, 19 Nov 2003 22:00:00 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMf30-0001nZ-8t
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 21:59:58 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMf2T-0001XN-JU
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 21:59:56 -0500
Received: from [69.19.166.25] (helo=o1-smfcorpmail.o1.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMf2T-0001WS-47
	for bug-commoncpp@gnu.org; Wed, 19 Nov 2003 21:59:25 -0500
Received: from mail.o1.com ([10.10.11.67]) by o1-smfcorpmail.o1.com with
	Microsoft SMTPSVC(5.0.2195.6713); Wed, 19 Nov 2003 17:59:55 -0800
From: Matt Scifo <mscifo@o1.com>
To: bug-commoncpp@gnu.org
In-Reply-To: <1069273747.20990.283.camel@localhost>
References: <1069273747.20990.283.camel@localhost>
Content-Type: text/plain
Message-Id: <1069293369.20989.322.camel@localhost>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.5 
Date: Wed, 19 Nov 2003 17:56:10 -0800
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 20 Nov 2003 01:59:55.0359 (UTC)
	FILETIME=[FE5D26F0:01C3AF09]
Subject: Re: Thread::isRunning() returning false even though thread hasn't
	fully terminated
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 20 Nov 2003 02:59:58 -0000

I've noticed some other interesting things regarding this issue.

Though I didn't mention it in my original post, the code that launches
my threads is part of a shared library that I link in with my main
application.  

Here is the code that loads the modules...

    DSO *handle;
    try {
        handle = new DSO(filename, false);
    } catch (DSO *error) {
        cout << "Error loading dso: " << error->getError() << endl;
        return false;
    };

    load_module_t* load_module = (load_module_t*)
(*handle)["load_module"];
    create_instance_t* create_instance = (create_instance_t*)
(*handle)["create_instance"];
    destroy_instance_t* destroy_instance = (destroy_instance_t*)
(*handle)["destroy_instance"];


load_module(), create_instance(), and destroy_instance() are extern C
functions that are included in each c++ module.

I noticed something funny when I added code to delete the dso handle. 
Immediately upon issuing a "delete handle" for the module MyThread, all
the threads terminate and show the proper GDB message 
"[Thread xxxxxxx (zombie) exited]".  So for some reason, threads are not
fully terminating until seconds after they have exited their run()
method and have been deleted, yet terminate immediately upon deleting
the dso handle that was used to load the module.  How strange is that?

So, while not fully satisfied that this was a valid workaround, this at
least gave me a way to make sure all threads were really terminating
before continuing.


The continuation is now causing me another thread headache.  After all
the threads have been deleted (as the result of a SIGHUP handler), my
application reloads it's configuration and attempts to recreate the
threads.  Note that it is fully recreating them, not trying to restart
the old threads (which don't even exist since they were deleted).  I
noticed that while the code to recreate the threads finished 
successfully without error, only a few threads were actually created. 
It didn't make any sense.  Until I did an "info threads" in GDB.

(gdb) info threads
// 35 MyThread module threads
  289 Thread -1080124624 (LWP 3460)  0xffffe002 in ?? ()
  288 Thread -1087489232 (LWP 3459)  0xffffe002 in ?? ()
  287 Thread -1094853840 (LWP 3458)  0xffffe002 in ?? ()
  286 Thread -1102218448 (LWP 3457)  0xffffe002 in ?? ()
  285 Thread -1109583056 (LWP 3456)  0xffffe002 in ?? ()
  284 Thread -1116947664 (LWP 3455)  0xffffe002 in ?? ()
  283 Thread -1124312272 (LWP 3454)  0xffffe002 in ?? ()
  282 Thread -1131676880 (LWP 3453)  0xffffe002 in ?? ()
  281 Thread -1139041488 (LWP 3452)  0xffffe002 in ?? ()
  280 Thread -1146406096 (LWP 3451)  0xffffe002 in ?? ()
  279 Thread -1153770704 (LWP 3450)  0xffffe002 in ?? ()
  278 Thread -1161135312 (LWP 3449)  0xffffe002 in ?? ()
  277 Thread -1168499920 (LWP 3448)  0xffffe002 in ?? ()
  276 Thread -1175864528 (LWP 3447)  0xffffe002 in ?? ()
  275 Thread -1183229136 (LWP 3446)  0xffffe002 in ?? ()
  274 Thread -1190593744 (LWP 3445)  0xffffe002 in ?? ()
  273 Thread -1197958352 (LWP 3444)  0xffffe002 in ?? ()
  272 Thread -1205322960 (LWP 3443)  0xffffe002 in ?? ()
  271 Thread -1212687568 (LWP 3442)  0xffffe002 in ?? ()
  270 Thread -1220052176 (LWP 3441)  0xffffe002 in ?? ()
  269 Thread -1227416784 (LWP 3440)  0xffffe002 in ?? ()
  268 Thread -1234781392 (LWP 3439)  0xffffe002 in ?? ()
  267 Thread -1242146000 (LWP 3438)  0xffffe002 in ?? ()
  266 Thread -1249510608 (LWP 3437)  0xffffe002 in ?? ()
  265 Thread -1256875216 (LWP 3436)  0xffffe002 in ?? ()
  264 Thread -1264239824 (LWP 3435)  0xffffe002 in ?? ()
  263 Thread -1271604432 (LWP 3434)  0xffffe002 in ?? ()
  262 Thread -1278969040 (LWP 3433)  0xffffe002 in ?? ()
  261 Thread -1286333648 (LWP 3432)  0xffffe002 in ?? ()
  260 Thread -1293698256 (LWP 3431)  0xffffe002 in ?? ()
  259 Thread -1301062864 (LWP 3430)  0xffffe002 in ?? ()
  258 Thread -1308427472 (LWP 3429)  0xffffe002 in ?? ()
  257 Thread -1315792080 (LWP 3428)  0xffffe002 in ?? ()
  256 Thread -1323156688 (LWP 3427)  0xffffe002 in ?? ()
  255 Thread -1330521296 (LWP 3426)  0xffffe002 in ?? ()
  254 Thread -1337885904 (LWP 3425)  0xffffe002 in ?? ()
// recreated module_handler thread
  253 Thread -1345250512 (LWP 3424)  0xffffe002 in ?? ()
// main process
* 1 Thread 1086991616 (LWP 3166)  0xffffe002 in ?? ()    

The number of threads my application creates is variable and can be
increased/decreased by calling a function and then of course reloading,
which is explained above.  In linux, the number of user-creatable
processes is quite high, but it is limited further by memory.  If the
required stack size for a thread is higher than the amount of free
memory, then boom you can't create any more threads, even if the OS says
your limit is much higher.

I am currently launching 250 threads of the MyThread module, along with
the main process and another module_handler thread.  So 252 threads
total.  

My current environment settings...

$ ulimit -s -u
stack size            (kbytes, -s) 7192
max user processes            (-u) 7168

That means that for each thread I launch I use 7192KB of memory.  When
my application HUPs it (supposedly) terminates the MyThread module
threads and the module_handler thread.  However, when it recreates the
module_handler and (in this case) the 250 MyThread module threads, GDB
shows that the thread count starts at 253.  From there it only launches
36 more threads (1 module_handler and 35 MyThread module threads) out of
251 threads before it reaches the operating system limit (due to memory
and required thread stack size) of 289 threads.

For some reason, threads are not properly terminating and registering
that termination with the kernel.

David, could this be a bug in the way commoncpp handles the termination
of threads?  This is really frustrating.  Can anyone help?

Thanks

Matt Scifo




From MAILER-DAEMON Thu Nov 20 06:07:47 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AMmf3-0006Dk-8j
	for mharc-bug-commoncpp@gnu.org; Thu, 20 Nov 2003 06:07:45 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AMmez-0006CA-4H
	for bug-commoncpp@gnu.org; Thu, 20 Nov 2003 06:07:41 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AMmeS-00063y-Rw
	for bug-commoncpp@gnu.org; Thu, 20 Nov 2003 06:07:39 -0500
Received: from [129.132.112.23] (helo=tri-e2k.d.ethz.ch)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMmeR-00063E-3S
	for bug-commoncpp@gnu.org; Thu, 20 Nov 2003 06:07:07 -0500
Received: from xfe2.d.ethz.ch ([192.168.36.11]) by tri-e2k.d.ethz.ch with
	Microsoft SMTPSVC(5.0.2195.6713); Thu, 20 Nov 2003 11:05:39 +0100
Received: from ethworld.ethz.ch ([129.132.39.115]) by xfe2.d.ethz.ch over TLS
	secured channel with Microsoft SMTPSVC(5.0.2195.6713); 
	Thu, 20 Nov 2003 11:05:39 +0100
Message-ID: <3FBC91F3.8070208@ethworld.ethz.ch>
Date: Thu, 20 Nov 2003 11:05:39 +0100
From: christoph ganser <ganser@ethworld.ethz.ch>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
	rv:1.5) Gecko/20030925
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 20 Nov 2003 10:05:39.0433 (UTC)
	FILETIME=[D995ED90:01C3AF4D]
Subject: MultiCast Probs
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 20 Nov 2003 11:07:43 -0000

Hi List

i have a little problem with multicast:
i wrote a little test application that has 2 threads, one is for 
sending, the other one for receiving multicast messages:
it some how does not work.

who do i have to setup a mutlicast socket?

i use a
class MCSender : public UDPTransmit, public Thread
 for sending.

in MCSender::run i
setMulticast(true)
InetMcastAddress("224.5.5.5");
Socket::join(dest);
connect(dest, 9898);
setTimeToLive(255);
const char message[] = "Hello Multicast";
transmit( (const char*) &message, strlen( (const char*) &message));

i don't get any errors (all Error == errSuccess)

but using tcpdump i only see:
messages from my host > 224.5.5.5 (DF) [ttl 1]
and
my host > ALL-ROUTERS.MCAST.NET: igmp leave 224.5.5.5 (DF) [ttl 1]

for the receiver i
class MCReceiver: public Thread, public UDPReceive
setMulticast(true)
join(dest)
if (isInputReady)
    length = receive( buffer, buffer_len);
...

could any body give me a hint?

thanks for any help!

christoph







From MAILER-DAEMON Tue Nov 25 19:56:23 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AOnyF-0004Tm-4V
	for mharc-bug-commoncpp@gnu.org; Tue, 25 Nov 2003 19:55:55 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AOmNu-0000eN-0A
	for bug-commoncpp@gnu.org; Tue, 25 Nov 2003 18:14:18 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AOmNL-0000Um-4K
	for bug-commoncpp@gnu.org; Tue, 25 Nov 2003 18:14:14 -0500
Received: from [144.189.100.105] (helo=motgate5.mot.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AOmMm-0000Fu-9I
	for bug-commoncpp@gnu.org; Tue, 25 Nov 2003 18:13:08 -0500
Received: from il06exr06.mot.com (il06exr06.mot.com [129.188.137.136])
	by motgate5.mot.com (Motorola/Motgate5) with ESMTP id hAPMBXdM015905
	for <bug-commoncpp@gnu.org>; Tue, 25 Nov 2003 15:11:34 -0700 (MST)
Received: from il27exm02.cig.mot.com (il27exm02.cig.mot.com [10.17.193.3])
	by il06exr06.mot.com (Motorola/il06exr06) with ESMTP id hAPMBS6u028613
	for <bug-commoncpp@gnu.org>; Tue, 25 Nov 2003 16:11:31 -0600
Received: by il27exm02.cig.mot.com with Internet Mail Service (5.5.2657.2)
	id <XJ5BC06Q>; Tue, 25 Nov 2003 16:11:28 -0600
Message-ID: <8F37768D4D9CD71192CF00065BF2598BDF3BB6@il27exm02.cig.mot.com>
From: Wodarczyk Christopher-CWODARC1 <CWODARC1@motorola.com>
To: "'bug-commoncpp@gnu.org'" <bug-commoncpp@gnu.org>
Date: Tue, 25 Nov 2003 16:11:27 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2657.2)
Content-Type: text/plain;
	charset="iso-8859-1"
X-Mailman-Approved-At: Tue, 25 Nov 2003 19:55:52 -0500
Subject: Strange behavior with errno...
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 25 Nov 2003 23:14:21 -0000


I am running a program which uses popen followed by fgets.  popen is used to redirect output from the 'bin/ps -a' command to a file pointer which is parsed by fgets.  I am seeing some strange behavior with the methods though....  here is the code as we've had it before....

    const int lineSize=80;
    char *cmd="/bin/ps -a"; // Run ps for all processes
    FILE *ptr;
    char buf[lineSize];
    char *unixPidStr, *junk, *process_name;
    int fileCnt = 0;
    char  *p = NULL;
    char  **pp = &p;
    std::ostringstream oss;

    if((ptr=popen(cmd,"r"))==NULL)
    {
      return(OM_FAIL);
    }
    // Read until list of PIDs is empty or until 5 are read, the max
    // Make sure to read and discard the first line, which is the header

    if(fgets(buf, lineSize, ptr) == NULL )
    {
      oss << "Any errors? " << strerror(errno) << endl;
      logInfo((oss.str()).c_str(), LogOrDisplay_t_LOG_ONLY, FN_ADMIN);
      pclose(ptr);
      return(OM_FAIL);
    }
    else
      logInfo(buf, LogOrDisplay_t_LOG_ONLY, FN_ADMIN);

-----------------------------------------------------------------------------

Now, if I change the code to this....

    const int lineSize=80;
    char *cmd="/bin/ps -a"; // Run ps for all processes
    FILE *ptr;
    char buf[lineSize];
    char *unixPidStr, *junk, *process_name;
    int fileCnt = 0;
    char  *p = NULL;
    char  **pp = &p;
    std::ostringstream oss;

    errno = 0; // Reset errno to 0
    if((ptr=popen(cmd,"r"))==NULL)
    {
      return(OM_FAIL);
    }
    // Read until list of PIDs is empty or until 5 are read, the max
    // Make sure to read and discard the first line, which is the header

    if(fgets(buf, lineSize, ptr) == NULL )
    {
      oss << "Any errors? " << strerror(errno) << endl;
      logInfo((oss.str()).c_str(), LogOrDisplay_t_LOG_ONLY, FN_ADMIN);
      pclose(ptr);
      return(OM_FAIL);
    }
    else
      logInfo(buf, LogOrDisplay_t_LOG_ONLY, FN_ADMIN);

    I end up in the else case and fgets parses my file just fine... is there some weird thing going on with errno?  I looked up the manpages which indicates errno is thread-safe (my program is multi-threaded) and I don't specifically set errno in any of my functions that I use anywhere.  It just seems necessary to zero out errno before I do the popen and fgets system calls....

BTW... without resetting errno the fault doesn't occur all the time.  Basically, this code is timed and gets executed about every 10 seconds or so... out 10 times, the fault occurs about 6 times... so it passes 4 out of 10 times without resetting errno to 0.

If I do decide to go with a fix with resetting errno to 0, is there any possible impact it could have on something...?

Thanks for any input!

Christopher Wodarczyk





From MAILER-DAEMON Thu Nov 27 11:41:06 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1APPBA-0003ax-33
	for mharc-bug-commoncpp@gnu.org; Thu, 27 Nov 2003 11:39:44 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AP7AD-0001Pb-3L
	for bug-commoncpp@gnu.org; Wed, 26 Nov 2003 16:25:33 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AP799-00018P-Ac
	for bug-commoncpp@gnu.org; Wed, 26 Nov 2003 16:24:59 -0500
Received: from [66.252.32.136] (helo=mail.midmaine.com)
	by monty-python.gnu.org with smtp (Exim 4.24) id 1AP798-000185-Fc
	for bug-commoncpp@gnu.org; Wed, 26 Nov 2003 16:24:26 -0500
Received: (qmail 24283 invoked by uid 48); 26 Nov 2003 20:22:55 -0000
Message-ID: <20031126202255.24280.qmail@mail.midmaine.com>
From: bc76@nospam.midmaine.com
To: bug-commoncpp@gnu.org
Date: Wed, 26 Nov 2003 15:22:55 -0500
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Mailman-Approved-At: Thu, 27 Nov 2003 11:39:42 -0500
Subject: ost::Digest class Re: protected initDigest() method
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 26 Nov 2003 21:25:33 -0000

The ost::MD5Digest/ost::SHA1Digest/ost::SHA256Digest classes all inherit 
from the abstract ost::Digest class.daThe ost::Digest class lists a 
protected abstract method, initDigest().daThe digest classes that inherit 
from ost::Digest make their initDigest() methods public.daI want to use the 
ost::Digest class as an interface to multiple digests.  That way I can have 
a function that takes a ost::Digest* and uses it for it's digest computing 
needs.   The shadigest.cpp demo program shows 
ost::SHA256Digest::initDigest() being called before the SHA256Digest 
instance is used.daAre newly created MD5/SHA1/SHA256Digests already inited, 
or does one have to call initDigest() before using one?  Why is 
ost::Digest::initDigest() protected and not public?



From MAILER-DAEMON Thu Nov 27 18:17:29 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1APVO5-0001xO-Dy
	for mharc-bug-commoncpp@gnu.org; Thu, 27 Nov 2003 18:17:29 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1APVO3-0001wx-3m
	for bug-commoncpp@gnu.org; Thu, 27 Nov 2003 18:17:27 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1APVNW-0001lA-Sg
	for bug-commoncpp@gnu.org; Thu, 27 Nov 2003 18:17:25 -0500
Received: from [209.225.28.219] (helo=mxsf19.cluster1.charter.net)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1APVNW-0001kP-Cw
	for bug-commoncpp@gnu.org; Thu, 27 Nov 2003 18:16:54 -0500
Received: from liliwhite.renaissance.oasis
	(c66.169.100.31.ts46v-01.mhe1.ftwrth.tx.charter.com [66.169.100.31])
	by mxsf19.cluster1.charter.net (8.12.10/8.12.8) with ESMTP id
	hARMBDt3074194; Thu, 27 Nov 2003 17:11:13 -0500 (EST)
	(envelope-from lizzy@soggytrousers.net)
Received: from lizzy by liliwhite.renaissance.oasis with local (Exim 3.35 #1
	(Debian)) id 1APULv-0002Ha-00; Thu, 27 Nov 2003 16:11:11 -0600
To: bc76@midmaine.com
References: <20031126202255.24280.qmail@mail.midmaine.com>
From: etb <lizzy@soggytrousers.net>
Date: 27 Nov 2003 16:11:11 -0600
In-Reply-To: bc76@nospam.midmaine.com's message of "Wed,
	26 Nov 2003 15:22:55 -0500"
Message-ID: <87wu9lzclc.fsf@liliwhite.renaissance.oasis>
Lines: 45
X-Mailer: Gnus v5.7/Emacs 20.7
Sender: Elizabeth Barham <lizzy@soggytrousers.net>
Cc: bug-commoncpp@gnu.org
Subject: Re: ost::Digest class Re: protected initDigest() method
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 27 Nov 2003 23:17:27 -0000

bc76@nospam.midmaine.com writes:

> The ost::MD5Digest/ost::SHA1Digest/ost::SHA256Digest classes all
> inherit from the abstract ost::Digest class. The ost::Digest class
> lists a protected abstract method, initDigest(). The digest classes
> that inherit from ost::Digest make their initDigest() methods
> public.

> I want to use the ost::Digest class as an interface to multiple
> digests.  That way I can have a function that takes a ost::Digest*
> and uses it for it's digest computing needs.  The shadigest.cpp demo
> program shows ost::SHA256Digest::initDigest() being called before
> the SHA256Digest instance is used.

> Are newly created MD5/SHA1/SHA256Digests already inited, or does one
> have to call initDigest() before using one?  Why is
> ost::Digest::initDigest() protected and not public?

For the SHA hashes, initDigest() needs to be called prior to any new
hash after the initial one. Since the demo program goes through each
file and we don't want to create a new instance of the digest object,
we call initDigest(). But, initDigest() is called in the constructor
so if you create a new object each time you want a new hash then you
won't need to call it. We could have done this (from shadigest.cpp):

  for(int i = 1 ; i < argc; i++) {
    FILE * fp = fopen(argv[i], "rb");
    if(i > 1) // new
      d256.initDigest();

    if(fp) {
      while((length =  fread(buff, sizeof(unsigned char), BUFF_SIZE, fp))) {
	d256.putDigest(buff, length);
      }
			
      std::cout << d256 << "  " << argv[i] << std::endl;

      fclose(fp);
    }
  }

As to why initDigest() is protected in the base class, however, I do
not know.

Elizabeth



From MAILER-DAEMON Fri Nov 28 13:23:05 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1APnGj-0001j4-CX
	for mharc-bug-commoncpp@gnu.org; Fri, 28 Nov 2003 13:23:05 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1APZgx-0003bp-79
	for bug-commoncpp@gnu.org; Thu, 27 Nov 2003 22:53:15 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1APZgQ-0003OR-5P
	for bug-commoncpp@gnu.org; Thu, 27 Nov 2003 22:53:14 -0500
Received: from [65.54.169.22] (helo=hotmail.com)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1APZgN-0003OK-OG
	for bug-commoncpp@gnu.org; Thu, 27 Nov 2003 22:52:39 -0500
Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
	Thu, 27 Nov 2003 18:51:12 -0800
Received: from 206.116.14.46 by by3fd.bay3.hotmail.msn.com with HTTP;
	Fri, 28 Nov 2003 02:51:12 GMT
X-Originating-IP: [206.116.14.46]
X-Originating-Email: [roadkillbunny@msn.com]
From: "Karol Krizka" <roadkillbunny@msn.com>
To: bug-commoncpp@gnu.org
Bcc: 
Date: Thu, 27 Nov 2003 18:51:12 -0800
Mime-Version: 1.0
Content-Type: text/plain; format=flowed
Message-ID: <BAY3-F22ecd92bXCH5n0001a841@hotmail.com>
X-OriginalArrivalTime: 28 Nov 2003 02:51:12.0939 (UTC)
	FILETIME=[7C0C97B0:01C3B55A]
X-Mailman-Approved-At: Fri, 28 Nov 2003 13:23:03 -0500
Subject: Problem Compiling FTPSocket Class
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 28 Nov 2003 03:53:15 -0000

Hello!

I am a newbie at using CommonC++, and I run into several problems. First was 
how to compile the programs, but I found a fix after a long search. I had to 
add the following when compiling:
-L/usr/lib -D_REENTRANT -D_THREAD_SAFE  -g -O2 -D_GNU_SOURCE  -lpthread 
/usr/lib/libccext2.a /usr/lib/libccgnu2.a
Then when I played around with the FTP class, I run into more compiling 
problems:
/tmp/cc5BNOu1.o(.text+0xc9): In function `main':
/usr/include/cc++/socket.h:1451: undefined reference to 
`ost::FTPSocket::FTPSocket[in-charge](ost::InetHostAddress, 
std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 
std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 
unsigned long)'
/tmp/cc5BNOu1.o(.text+0x142): In function `main':
/usr/include/c++/3.2.3/bits/basic_string.h:338: undefined reference to 
`ost::FTPSocket::pwd()'
/tmp/cc5BNOu1.o(.text+0x1c1): In function `main':
/usr/include/c++/3.2.3/bits/stl_alloc.h:668: undefined reference to 
`ost::FTPSocket::~FTPSocket [in-charge]()'
/tmp/cc5BNOu1.o(.text+0x3bf):/usr/include/c++/3.2.3/bits/stl_alloc.h:668: 
undefined reference to `ost::FTPSocket::~FTPSocket [in-charge]()'
collect2: ld returned 1 exit status
make: *** [ftp] Error 1

I am at a loss here, and have no idea what to do. Can anyone help me? I 
attached the program at the end of the email.

CHEERS
--RoadkillBunny

CODE ftp.cpp
-------------------------------------------------
#include <cc++/ftp.h>
#include <cc++/socket.h>
#include <iostream>
#include <unistd.h>
#include <string.h>

using namespace std;
using namespace ost;

int main(int argc,char* argv[]) {
  //  if(argc!=2) {
  // cout << "Usage: myftp server" << endl;
  // exit(0);
  //}

  string user;
  string passwd;

  cout<<"Username: "; cin>>user;
  cout<<"Password: "; cin>>passwd;
  InetHostAddress h1("localhost");
  FTPSocket ftp1(h1,user,passwd,100);
  string pwd;

  pwd=ftp1.pwd();
  cout<<"PWD: "<<pwd<<endl;
  return 0;
}

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca




From MAILER-DAEMON Sat Nov 29 08:11:38 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AQ4ss-00026D-8D
	for mharc-bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:11:38 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AQ4sq-00025m-4e
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:11:36 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AQ4sI-0001ui-U3
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:11:35 -0500
Received: from [199.232.41.8] (helo=mx20.gnu.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.24) id 1AQ4oW-0001OH-CD
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:07:08 -0500
Received: from [217.217.172.75] (helo=paraguas)
	by mx20.gnu.org with esmtp (Exim 4.24) id 1AQ3pz-0001Ck-2u
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 07:04:35 -0500
Received: from fedemp by paraguas with local (Exim 3.36 #1 (Debian))
	id 1AQ3uM-0000ZO-00; Sat, 29 Nov 2003 13:09:06 +0100
Date: Sat, 29 Nov 2003 13:09:06 +0100
From: Federico Montesino Pouzols <fedemp@altern.org>
To: Karol Krizka <roadkillbunny@msn.com>
Message-ID: <20031129120906.GA2083@paraguas>
Mail-Followup-To: Karol Krizka <roadkillbunny@msn.com>, bug-commoncpp@gnu.org
References: <BAY3-F22ecd92bXCH5n0001a841@hotmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <BAY3-F22ecd92bXCH5n0001a841@hotmail.com>
User-Agent: Mutt/1.5.4i
Cc: bug-commoncpp@gnu.org
Subject: Re: Problem Compiling FTPSocket Class
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: Federico Montesino Pouzols <fedemp@altern.org>
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 29 Nov 2003 13:11:36 -0000


	Hi, you should not enter these flags by hand, but use the
output of the ccgnu2-config script that is installed with cc++. Try
'ccgnu2-config --help' to see the options. You will need to use
something like `ccgnu2-config --flags --libs --extlibs` which will
give something similar to the flags you are specifying by hand, but
tailored for your system. 

On Thu, Nov 27, 2003 at 06:51:12PM -0800, Karol Krizka wrote:
> Hello!
> 
> I am a newbie at using CommonC++, and I run into several problems. First 
> was how to compile the programs, but I found a fix after a long search. I 
> had to add the following when compiling:
> -L/usr/lib -D_REENTRANT -D_THREAD_SAFE  -g -O2 -D_GNU_SOURCE  -lpthread 
> /usr/lib/libccext2.a /usr/lib/libccgnu2.a
> Then when I played around with the FTP class, I run into more compiling 
> problems:
> /tmp/cc5BNOu1.o(.text+0xc9): In function `main':
> /usr/include/cc++/socket.h:1451: undefined reference to 
> `ost::FTPSocket::FTPSocket[in-charge](ost::InetHostAddress, 
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 
> unsigned long)'
> /tmp/cc5BNOu1.o(.text+0x142): In function `main':
> /usr/include/c++/3.2.3/bits/basic_string.h:338: undefined reference to 
> `ost::FTPSocket::pwd()'
> /tmp/cc5BNOu1.o(.text+0x1c1): In function `main':
> /usr/include/c++/3.2.3/bits/stl_alloc.h:668: undefined reference to 
> `ost::FTPSocket::~FTPSocket [in-charge]()'
> /tmp/cc5BNOu1.o(.text+0x3bf):/usr/include/c++/3.2.3/bits/stl_alloc.h:668: 
> undefined reference to `ost::FTPSocket::~FTPSocket [in-charge]()'
> collect2: ld returned 1 exit status
> make: *** [ftp] Error 1
> 
> I am at a loss here, and have no idea what to do. Can anyone help me? I 
> attached the program at the end of the email.
> 
> CHEERS
> --RoadkillBunny
> 
> CODE ftp.cpp
> -------------------------------------------------
> #include <cc++/ftp.h>
> #include <cc++/socket.h>
> #include <iostream>
> #include <unistd.h>
> #include <string.h>
> 
> using namespace std;
> using namespace ost;
> 
> int main(int argc,char* argv[]) {
>  //  if(argc!=2) {
>  // cout << "Usage: myftp server" << endl;
>  // exit(0);
>  //}
> 
>  string user;
>  string passwd;
> 
>  cout<<"Username: "; cin>>user;
>  cout<<"Password: "; cin>>passwd;
>  InetHostAddress h1("localhost");
>  FTPSocket ftp1(h1,user,passwd,100);
>  string pwd;
> 
>  pwd=ftp1.pwd();
>  cout<<"PWD: "<<pwd<<endl;
>  return 0;
> }
> 
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE*  
> http://join.msn.com/?page=features/virus&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
> 
> 
> 
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



From MAILER-DAEMON Sat Nov 29 08:37:15 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AQ5Hf-0003xE-56
	for mharc-bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:37:15 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AQ5Hc-0003x8-Tw
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:37:12 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AQ5H5-0003d2-Ur
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:37:11 -0500
Received: from [217.217.172.75] (helo=paraguas)
	by monty-python.gnu.org with esmtp (Exim 4.24) id 1AQ5H5-0003bK-BM
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 08:36:39 -0500
Received: from fedemp by paraguas with local (Exim 3.36 #1 (Debian))
	id 1AQ4L3-0000fM-00; Sat, 29 Nov 2003 13:36:41 +0100
Date: Sat, 29 Nov 2003 13:36:41 +0100
From: Federico Montesino Pouzols <fedemp@altern.org>
To: bc76@nospam.midmaine.com
Message-ID: <20031129123641.GB2083@paraguas>
Mail-Followup-To: bc76@nospam.midmaine.com, bug-commoncpp@gnu.org
References: <20031126202255.24280.qmail@mail.midmaine.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20031126202255.24280.qmail@mail.midmaine.com>
User-Agent: Mutt/1.5.4i
Cc: bug-commoncpp@gnu.org
Subject: Re: ost::Digest class Re: protected initDigest() method
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: Federico Montesino Pouzols <fedemp@altern.org>
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 29 Nov 2003 13:37:13 -0000


	Hi,

On Wed, Nov 26, 2003 at 03:22:55PM -0500, bc76@nospam.midmaine.com wrote:
> The ost::MD5Digest/ost::SHA1Digest/ost::SHA256Digest classes all inherit 
> from the abstract ost::Digest class.daThe ost::Digest class lists a 
> protected abstract method, initDigest().daThe digest classes that inherit 
> from ost::Digest make their initDigest() methods public.daI want to use the 
> ost::Digest class as an interface to multiple digests.  That way I can have 
> a function that takes a ost::Digest* and uses it for it's digest computing 
> needs.

	It seems that initDigest was originally intended to be used
only internally by derived classes, but I think the idea you propose
is quite interesting. I see no reason why initDigest cannot be public.
Should we make it public?



From MAILER-DAEMON Sat Nov 29 09:26:35 2003
Received: from list by monty-python.gnu.org with archive (Exim 4.24)
	id 1AQ63P-0004OL-Nm
	for mharc-bug-commoncpp@gnu.org; Sat, 29 Nov 2003 09:26:35 -0500
Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24)
	id 1AQ63O-0004Mc-Eh
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 09:26:34 -0500
Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24)
	id 1AQ62s-00047X-MC
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 09:26:33 -0500
Received: from [141.153.146.157] (helo=localhost.bayonne.dyndns.org)
	by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 4.24) id 1AQ62s-00047I-8F
	for bug-commoncpp@gnu.org; Sat, 29 Nov 2003 09:26:02 -0500
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by localhost.bayonne.dyndns.org (8.12.8/8.12.8) with ESMTP id
	hATFNS3Z011676; Sat, 29 Nov 2003 10:23:28 -0500
Received: (from apache@localhost)
	by localhost.localdomain (8.12.8/8.12.8/Submit) id hATFNSnA011674;
	Sat, 29 Nov 2003 10:23:28 -0500
X-Authentication-Warning: localhost.localdomain: apache set sender to
	dyfet@ostel.com using -f
Received: from 207.93.155.249 (SquirrelMail authenticated user dyfet)
	by bayonne.dyndns.org with HTTP;
	Sat, 29 Nov 2003 10:23:27 -0500 (EST)
Message-ID: <1231.207.93.155.249.1070119407.squirrel@bayonne.dyndns.org>
Date: Sat, 29 Nov 2003 10:23:27 -0500 (EST)
From: "David Sugar" <dyfet@ostel.com>
To: <fedemp@altern.org>
In-Reply-To: <20031129123641.GB2083@paraguas>
References: <20031126202255.24280.qmail@mail.midmaine.com>
	<20031129123641.GB2083@paraguas>
X-Priority: 3
Importance: Normal
X-Mailer: SquirrelMail (version 1.2.11)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Cc: bc76@nospam.midmaine.com, bug-commoncpp@gnu.org
Subject: Re: ost::Digest class Re: protected initDigest() method
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: Bug reports for Common C++  <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 29 Nov 2003 14:26:35 -0000

Yes, it was originally meant as a method to be used in other derived
classes.  But I see no issues with changing it either, so long as any
changes like this one are also tracked in the "testing" branch.

David

Federico Montesino Pouzols said:
>
> 	Hi,
>
> On Wed, Nov 26, 2003 at 03:22:55PM -0500, bc76@nospam.midmaine.com
> wrote:
>> The ost::MD5Digest/ost::SHA1Digest/ost::SHA256Digest classes all
>> inherit  from the abstract ost::Digest class.daThe ost::Digest class
>> lists a  protected abstract method, initDigest().daThe digest classes
>> that inherit  from ost::Digest make their initDigest() methods
>> public.daI want to use the  ost::Digest class as an interface to
>> multiple digests.  That way I can have  a function that takes a
>> ost::Digest* and uses it for it's digest computing  needs.
>
> 	It seems that initDigest was originally intended to be used
> only internally by derived classes, but I think the idea you propose is
> quite interesting. I see no reason why initDigest cannot be public.
> Should we make it public?
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> Bug-commoncpp@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp






