*calledPtr = true;
};
mplexer->addReadFD(pipes[0],
- readCB,
- &readCBCalled,
- &ttd);
+ readCB,
+ &readCBCalled,
+ &ttd);
/* not ready for reading yet */
readyFDs.clear();
/* both should be available */
readyFDs.clear();
mplexer->getAvailableFDs(readyFDs, 0);
+ if (readyFDs.size() == 1) {
+ /* something is wrong, we need some debug infos */
+ cerr<<"FDMultiPlexer implementation is "<<mplexer->getName()<<endl;
+ cerr<<"Watching "<<mplexer->getWatchedFDCount(false)<<" FDs for read and "<<mplexer->getWatchedFDCount(true)<<" for write"<<endl;
+ cerr<<"pipes[0] is "<<pipes[0]<<endl;
+ cerr<<"pipes[1] is "<<pipes[1]<<endl;
+ cerr<<"The file descripttor returned as ready is "<<readyFDs.at(0)<<endl;
+ char buffer[2];
+ ssize_t res = read(pipes[0], &buffer[0], sizeof(buffer));
+ cerr<<"Reading from pipes[0] returns "<<res<<endl;
+ if (res == -1) {
+ cerr<<"errno is "<<errno<<endl;
+ }
+ res = write(pipes[1], "0", 1);
+ cerr<<"Writing to pipes[1] returns "<<res<<endl;
+ if (res == -1) {
+ cerr<<"errno is "<<errno<<endl;
+ }
+ }
BOOST_REQUIRE_EQUAL(readyFDs.size(), 2);
readCBCalled = false;