 | Hi,
In the process of trying to write a streams test, I found that the task's within a module are not getting their sibling(), is_reader(), and is_writer() member functions setup correctly.
I am assuming that these functions are initialized when the module is constructed, since they are only meaningful in that context.
If I create a task, a module containing two of those tasks, and a stream with that module, then I find that the ACE_Module reader(), writer(), and sibling() members are initialized ok.
The test code is here:
http://www.ovro.caltech.edu/~dwh/ace/simple_stream.cpp
and its output
http://www.ovro.caltech.edu/~dwh/ace/simple_stream.txt
is repeated here, with annotations:
------------------------------ Stream: open() Stream: creating a module ------------------------------ Module: constructor Stream: module name 'Module' Stream: module reader is non-NULL Stream: reader sibling is non-NULL Stream: reader sibling is the writer Stream: module writer is non-NULL Stream: writer sibling is non-NULL Stream: writer sibling is the reader Stream: inserting a module
>>>> So all the module member variables seem to be setup ok.
------------------------------ Task: open() Task: READER Task: is_writer() is true Task: error module name is not set Task: sibling is not set
>>>> The task constructor is passed a flag to identify whether it was passed to the module constructor as a reader or writer. This one was passed as a reader, but the is_writer() returns true!
>>>> The name() and sibling() functions are not set.
------------------------------ Task: open() Task: WRITER Task: is_writer() is true Task: error module name is not set Task: sibling is not set
>>>> The name() and sibling() functions are not set.
Is it the user's responsibility to setup these member calls in the module?
I've looked at the examples in the ACE Tutorials area (14 and 15), in C++NPv2, in APG, and in the ACE Tutorial (Syidd), but have not seen examples that need to setup this info.
I was trying to write a loop-back module where I wanted to feed a response back into the stream, eg. a module with two loopback tasks, where the loopback task defines a passive put method implemented something like ...
int put(ACE_Message_Block *mblk, ACE_Time_Value *tv) { if (is_writer()) { if (sibling()) { return sibling()->put_next(mblk, tv); } } return 0; }
But sibling() returns NULL in the task, when I believe it should return a pointer to the reader side!
I'll go off and look at the ACE_Module implementation now, but figured I'd see if anyone had some feedback.
Cheers Dave Hawkins Caltech.
|
|