Am Donnerstag, 3. September 2009 schrieb Mike Kaplinskiy:
On Wed, Sep 2, 2009 at 7:31 PM, Fenixk19fenixk19@mail.ru wrote:
Hello! I've already post the bug(http://bugs.winehq.org/show_bug.cgi?id=19713) on this subject, but i need more help. So I've decided to write here. There is a problem in wine. When I use asynchronous serial port read, data never comes. Event, caused by select comes. But operation status stays pending, and i can't do anything to this serial port anymore. In windows it never get pending, and port can be accessed just after data arrival. Seems to be wineserver problem, but i don't know, where to look at. What code respond for asynchronous serial port in wineserver? Alexander. P.S. Test program attached.
Hi,
Alexandre would be the guy to talk to about wineserver-related things. Sadly he's off on a long weekend. Does the attached patch help solve the problem?
Isn't setting commio->iosb->u.Status racy?
commio->iosb may be set from wait_for_event() which is called by an extra thread or by io_control().
Couldn't it happen that
wait_on starts the thread wait_for_event sets the commio->iosb->u.Status to STATUS_SUCCESS wait_on returns to io_control STATUS_PENDING io_control overwrites commio->iosb->u.Status with STATUS_PENDING
I think io_control() should set commio->iosb->u.Status to STATUS_PENDING before calling wait_on(). After wait_on() io_control() should not set commio->iosb->u.Status if wait_on() returns STATUS_PENDING. Here the idea:
------------------ case IOCTL_SERIAL_WAIT_ON_MASK: if (lpOutBuffer && nOutBufferSize == sizeof(DWORD)) { piosb->u.Status = STATUS_PENDING; piosb->Information = sz; if (!(status = wait_on(hDevice, fd, hEvent, piosb, lpOutBuffer))) sz = sizeof(DWORD); else if (status == STATUS_PENDING) return status; } else status = STATUS_INVALID_PARAMETER; break; -------------------
Regards,