bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: common cpp 2 (1.0.13) under win32 platform (winXP)


From: David Sugar
Subject: Re: common cpp 2 (1.0.13) under win32 platform (winXP)
Date: Wed, 18 Feb 2004 12:43:33 -0500
User-agent: KMail/1.5.3

I just found an equally interesting and more serious bug in 1.1.0 "terminate" 
function (w32 target only) which may also be in w32 for 1.0.13 as well; 
setting of _self.setKey(DUMMY_INVALID_THREAD) should NOT happen in terminate 
unless the current thread context is a (self)exiting thread context, or it 
could be removed completely.  Otherwise it kills the back-pointer object 
pointer to the thread that caused termination rather than the thread that is 
being terminated, and hence getThread() becomes NULL for that thread, and 
this is bad for slog() among other things....

I would like to see if this change for serial can be standardized into a patch 
for 1.1.1.

On Wednesday 18 February 2004 05:57 am, Cronos wrote:
> Hello!
>
> I am developer in a small company and I try to make some cross-platform
> application for our purposes. But under win32 platform (today is a
> target platform for our software) I have got several bugs (or my
> misundestoods?).
>
> First, In the serial.cpp class under windows I have got undesired
> behaviuor in the input stream (from modem). when I send the some
> sequense like "ath", I have got only first letter "a". This behaviour is
> occured due to somthing in the windows reading file mechanizm. I have
> written additional function for avoid this.
>
> In the serial.h:
> ...
>          enum Queue
>          {
>                  queueInput,
>                  queueOutput
>          };
>          typedef enum Queue Queue;
> ...
> public:
> ...
>
>          /**
>           * Get the size of pending queue.
>           *
>           * @return size of the queue
>           * @param que type of the queue
>           */
>          int getQueueSize(Queue que);
> ...
>
> In the serial.cpp
>
> ...
> int Serial::getQueueSize(Queue queue)
> {
> #ifdef WIN32
>          unsigned long   dwError;
>          COMSTAT cs;
>
>          ClearCommError(dev, &dwError, &cs);
>
>          switch(queue)
>          {
>          case queueInput:
>                  return cs.cbInQue;
>          case queueOutput:
>                  return cs.cbOutQue;
>          }
> #else
>          // not implemented yet...
> #endif // !WIN32
>          return 0;
> }
> ...
>
>
> After this changes I have fixed the SerialEcho.cpp sample:
> ...
>      while (isPending(Serial::pendingInput)) {
>        int x = getQueueSize(Serial::queueInput);
>        cout << "queue size: " << x << endl;
>
>        while (x-- > 0)
>          cout.put( get() );
>        cout << endl;
>      }
> ...
>
> Additionaly to above, I try to build other samples under win32 by
> msvc6.0. But almost of they are not contained ws2_32.lib in the project
> options. Please, check it.
>
> Thank you for good library!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]