You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(622) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(303) |
Feb
(64) |
Mar
(5) |
Apr
(63) |
May
(82) |
Jun
(53) |
Jul
(50) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Marc D. <ma...@us...> - 2005-02-14 20:58:25
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14845/src/System Modified Files: SerialDevice.linux.cpp Log Message: added set/get for CharSize Index: SerialDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SerialDevice.linux.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SerialDevice.linux.cpp 14 Feb 2005 20:26:10 -0000 1.1 +++ SerialDevice.linux.cpp 14 Feb 2005 20:58:06 -0000 1.2 @@ -133,6 +133,52 @@ return BaudRate0; } +void SerialDevice::setCharSize(SerialDevice::CharSize csize) throw(IO::IOError) { + int size; + switch(csize) { + case CharSize5 : size = CS5; + case CharSize6 : size = CS6; + case CharSize7 : size = CS7; + case CharSize8 : size = CS8; + default: DefaultCharSize : size = CS7; + } + + struct termios ios; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not set char size", P_SOURCEINFO); + } + + if( size == SerialDevice::CharSize8 ) { + ios.c_iflag &= ~ISTRIP; + } else { + ios.c_iflag |= ISTRIP; + } + ios.c_cflag &= ~CSIZE; + ios.c_cflag |= size; + + if( ::tcsetattr(this->nosHandle(), TCSANOW, &ios) == -1) { + throw IO::IOError(errno, "Could not set char size", P_SOURCEINFO); + } +} + +SerialDevice::CharSize SerialDevice::charSize() throw(IO::IOError) { + struct termios ios; + if( ::tcgetattr(this->nosHandle(), &ios) == -1 ) { + throw IO::IOError(errno, "Could not get char size", P_SOURCEINFO); + } + + int size = (ios.c_cflag & CSIZE); + switch(size) { + case CS5 : return CharSize5; + case CS6 : return CharSize6; + case CS7 : return CharSize7; + case CS8 : return CharSize8; + default: return DefaultCharSize; + } + + return CharSize7; +} + void SerialDevice::put(const UInt8& byte) throw(IO::IOError) { this->write((const char*)(&byte), 1); } |
From: Marc D. <ma...@us...> - 2005-02-14 20:58:15
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14845/include/pclasses/System Modified Files: SerialDevice.h Log Message: added set/get for CharSize Index: SerialDevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/SerialDevice.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SerialDevice.h 14 Feb 2005 20:25:59 -0000 1.1 +++ SerialDevice.h 14 Feb 2005 20:58:05 -0000 1.2 @@ -59,6 +59,47 @@ BaudRate230400 }; + enum CharSize { + CharSize5, + CharSize6, + CharSize7, + CharSize8, + DefaultCharSize + }; + + enum Parity { + ParityEven, + ParityOdd, + ParityNone + }; + + enum FlowControl { + FlowControlHard, + FlowControlSoft + }; + + enum InputMode { + IgnoreBreak, + IgnoreParityError + }; + + enum OutputMode { + CRtoNL, + IgnoreNL, + IgnoreCR + }; + + enum ControlMode { + EnableReceiver, + LocalLine, + HangupLine + }; + + enum LocalMode { + Echo, + NoFlush + }; + enum FlushMode { FlushInput, FlushOutput, @@ -78,6 +119,10 @@ BaudRate baudRate() throw(IO::IOError); + void setCharSize(CharSize csize) throw(IO::IOError); + + CharSize charSize() throw(IO::IOError); + void put(const UInt8& byte) throw(IO::IOError); UInt8 get() throw(IO::IOError); |
From: Marc D. <ma...@us...> - 2005-02-14 20:26:38
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1682/include/pclasses/System Modified Files: Makefile.am Added Files: SerialDevice.h Log Message: added SerialDevice and Ps2Device adaptions Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.am 14 Feb 2005 19:13:35 -0000 1.10 +++ Makefile.am 14 Feb 2005 20:25:58 -0000 1.11 @@ -5,4 +5,4 @@ pclasses_system_include_HEADERS = SystemError.h SharedMemory.h CriticalSection.h Mutex.h \ Condition.h Semaphore.h Thread.h SharedLib.h File.h FileInfo.h \ Directory.h SystemClock.h ProcessIO.h Process.h ThreadKey.h StorageDevice.h \ - IdeDevice.h Ps2Device.h EventQueue.h + IdeDevice.h Ps2Device.h SerialDevice.h EventQueue.h --- NEW FILE: SerialDevice.h --- (This appears to be a binary file; contents omitted.) |
From: Marc D. <ma...@us...> - 2005-02-14 20:26:20
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1682/src/System Modified Files: Makefile.am Ps2Device.linux.cpp Added Files: SerialDevice.linux.cpp Log Message: added SerialDevice and Ps2Device adaptions Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Makefile.am 14 Feb 2005 19:13:35 -0000 1.15 +++ Makefile.am 14 Feb 2005 20:26:00 -0000 1.16 @@ -73,7 +73,8 @@ Time_Sources = SystemClock.win32.cpp endif -System_Sources = CdRomDevice.linux.cpp IdeDevice.linux.cpp Ps2Device.linux.cpp +System_Sources = CdRomDevice.linux.cpp IdeDevice.linux.cpp Ps2Device.linux.cpp \ + SerialDevice.linux.cpp EXTRA_DIST = CriticalSection.generic.cpp CriticalSection.win32.cpp \ Mutex.solaris.cpp Mutex.posix.cpp Mutex.win32.cpp SharedMemory.sysv.cpp \ --- NEW FILE: SerialDevice.linux.cpp --- (This appears to be a binary file; contents omitted.) Index: Ps2Device.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Ps2Device.linux.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Ps2Device.linux.cpp 14 Feb 2005 19:44:31 -0000 1.3 +++ Ps2Device.linux.cpp 14 Feb 2005 20:26:10 -0000 1.4 @@ -79,12 +79,14 @@ pfd[0].events = POLLIN; if( poll(pfd, 1, 800) > 0 ) { - ret = Device::read(buffer, count); + ret = _handle->read(buffer, count); return ret; - } else throw IO::IOError(errno, "Could not read from device.", P_SOURCEINFO); - + } + else { + throw IO::IOError(errno, "Could not read from device.", P_SOURCEINFO); + } + return ret; - //return _handle->read(buffer, count); } |
From: Marc D. <ma...@us...> - 2005-02-14 19:44:40
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15147/src/System Modified Files: Ps2Device.linux.cpp Log Message: changed peek() Index: Ps2Device.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Ps2Device.linux.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Ps2Device.linux.cpp 14 Feb 2005 19:39:15 -0000 1.2 +++ Ps2Device.linux.cpp 14 Feb 2005 19:44:31 -0000 1.3 @@ -75,7 +75,7 @@ { size_t ret = 0; struct pollfd pfd[1]; - pfd[0].fd = Device::handle(); + pfd[0].fd = this->nosHandle(); pfd[0].events = POLLIN; if( poll(pfd, 1, 800) > 0 ) { @@ -90,7 +90,7 @@ size_t Ps2Device::_peek(char* buffer, size_t count) throw(IO::IOError) { - return _handle->peek(buffer, count); + return 0; } size_t Ps2Device::_write(const char* buffer, size_t count) throw(IO::IOError) |
From: Marc D. <ma...@us...> - 2005-02-14 19:39:25
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12446/src/System Modified Files: Ps2Device.linux.cpp Log Message: adapted read() seek() and size() for Ps2Device Index: Ps2Device.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Ps2Device.linux.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Ps2Device.linux.cpp 14 Feb 2005 19:13:36 -0000 1.1 +++ Ps2Device.linux.cpp 14 Feb 2005 19:39:15 -0000 1.2 @@ -73,7 +73,19 @@ size_t Ps2Device::_read(char* buffer, size_t count) throw(IO::IOError) { - return _handle->read(buffer, count); + size_t ret = 0; + struct pollfd pfd[1]; + pfd[0].fd = Device::handle(); + pfd[0].events = POLLIN; + + if( poll(pfd, 1, 800) > 0 ) { + ret = Device::read(buffer, count); + return ret; + } else throw IO::IOError(errno, "Could not read from device.", P_SOURCEINFO); + + return ret; + + //return _handle->read(buffer, count); } size_t Ps2Device::_peek(char* buffer, size_t count) throw(IO::IOError) @@ -81,31 +93,29 @@ return _handle->peek(buffer, count); } -size_t Ps2Device::_write(const char* buffer, size_t count) - throw(IO::IOError) +size_t Ps2Device::_write(const char* buffer, size_t count) throw(IO::IOError) { return _handle->write(buffer, count); } -offset_t Ps2Device::_seek(offset_t offset, SeekMode mode) - throw(IO::IOError) +offset_t Ps2Device::_seek(offset_t offset, SeekMode mode) throw(IO::IOError) { - return _handle->seek(offset, mode); + return 0; } bool Ps2Device::_isSeekable() const throw() { - return _handle->isSeekable(); + return false; } void Ps2Device::_sync() const throw(IO::IOError) { - _handle->sync(); + } offset_t Ps2Device::_size() const throw(IO::IOError) { - return _handle->size(); + return 0; } unsigned long Ps2Device::nosHandle() const throw() |
From: Marc D. <ma...@us...> - 2005-02-14 19:13:44
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2659/include/pclasses/System Modified Files: Makefile.am Added Files: Ps2Device.h Log Message: added System::Ps2Device --- NEW FILE: Ps2Device.h --- (This appears to be a binary file; contents omitted.) Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile.am 14 Feb 2005 18:40:38 -0000 1.9 +++ Makefile.am 14 Feb 2005 19:13:35 -0000 1.10 @@ -5,4 +5,4 @@ pclasses_system_include_HEADERS = SystemError.h SharedMemory.h CriticalSection.h Mutex.h \ Condition.h Semaphore.h Thread.h SharedLib.h File.h FileInfo.h \ Directory.h SystemClock.h ProcessIO.h Process.h ThreadKey.h StorageDevice.h \ - IdeDevice.h EventQueue.h + IdeDevice.h Ps2Device.h EventQueue.h |
From: Marc D. <ma...@us...> - 2005-02-14 19:13:44
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2659/src/System Modified Files: Makefile.am Added Files: Ps2Device.linux.cpp Log Message: added System::Ps2Device Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Makefile.am 14 Feb 2005 18:40:39 -0000 1.14 +++ Makefile.am 14 Feb 2005 19:13:35 -0000 1.15 @@ -73,7 +73,7 @@ Time_Sources = SystemClock.win32.cpp endif -System_Sources = CdRomDevice.linux.cpp IdeDevice.linux.cpp +System_Sources = CdRomDevice.linux.cpp IdeDevice.linux.cpp Ps2Device.linux.cpp EXTRA_DIST = CriticalSection.generic.cpp CriticalSection.win32.cpp \ Mutex.solaris.cpp Mutex.posix.cpp Mutex.win32.cpp SharedMemory.sysv.cpp \ --- NEW FILE: Ps2Device.linux.cpp --- (This appears to be a binary file; contents omitted.) |
From: Marc D. <ma...@us...> - 2005-02-14 18:40:48
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21882/src/System Modified Files: Makefile.am Added Files: IdeDevice.linux.cpp Log Message: added System::IdeDevice Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.am 7 Feb 2005 18:41:07 -0000 1.13 +++ Makefile.am 14 Feb 2005 18:40:39 -0000 1.14 @@ -73,7 +73,7 @@ Time_Sources = SystemClock.win32.cpp endif -System_Sources = CdRomDevice.linux.cpp +System_Sources = CdRomDevice.linux.cpp IdeDevice.linux.cpp EXTRA_DIST = CriticalSection.generic.cpp CriticalSection.win32.cpp \ Mutex.solaris.cpp Mutex.posix.cpp Mutex.win32.cpp SharedMemory.sysv.cpp \ --- NEW FILE: IdeDevice.linux.cpp --- (This appears to be a binary file; contents omitted.) |
From: Marc D. <ma...@us...> - 2005-02-14 18:40:48
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21882/include/pclasses/System Modified Files: Makefile.am Added Files: IdeDevice.h Log Message: added System::IdeDevice Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile.am 7 Feb 2005 18:41:06 -0000 1.8 +++ Makefile.am 14 Feb 2005 18:40:38 -0000 1.9 @@ -5,4 +5,4 @@ pclasses_system_include_HEADERS = SystemError.h SharedMemory.h CriticalSection.h Mutex.h \ Condition.h Semaphore.h Thread.h SharedLib.h File.h FileInfo.h \ Directory.h SystemClock.h ProcessIO.h Process.h ThreadKey.h StorageDevice.h \ - EventQueue.h + IdeDevice.h EventQueue.h --- NEW FILE: IdeDevice.h --- (This appears to be a binary file; contents omitted.) |
From: Marc D. <ma...@us...> - 2005-02-14 16:46:56
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4932/src/System Modified Files: CdRomDevice.linux.cpp Log Message: added media change detection Index: CdRomDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/CdRomDevice.linux.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CdRomDevice.linux.cpp 14 Feb 2005 16:38:46 -0000 1.4 +++ CdRomDevice.linux.cpp 14 Feb 2005 16:46:46 -0000 1.5 @@ -162,6 +162,15 @@ throw IO::IOError(errno, "ioctl error on device", P_SOURCEINFO); } +bool CdRomDevice::mediaChanged() throw(IO::IOError) { + // the return value indicates whether the media was changed. + int ret = ::ioctl((int)handle(), CDROM_MEDIA_CHANGED); + if(ret >= 0) + return true; + + return false; +} + void CdRomDevice::eject() throw(IO::IOError) { int ret = ::ioctl((int)handle(), CDROMEJECT); |
From: Marc D. <ma...@us...> - 2005-02-14 16:46:55
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4932/include/pclasses/System Modified Files: CdRomDevice.h Log Message: added media change detection Index: CdRomDevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/CdRomDevice.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CdRomDevice.h 14 Feb 2005 16:38:46 -0000 1.4 +++ CdRomDevice.h 14 Feb 2005 16:46:46 -0000 1.5 @@ -75,6 +75,8 @@ DiscStatus discStatus() throw(IO::IOError); + bool mediaChanged() throw(IO::IOError); + //! Eject media void eject() throw(IO::IOError); |
From: Marc D. <ma...@us...> - 2005-02-14 16:38:55
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1487/src/System Modified Files: CdRomDevice.linux.cpp Log Message: added close tray method to CdRomDevice Index: CdRomDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/CdRomDevice.linux.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CdRomDevice.linux.cpp 14 Feb 2005 16:33:35 -0000 1.3 +++ CdRomDevice.linux.cpp 14 Feb 2005 16:38:46 -0000 1.4 @@ -169,6 +169,12 @@ throw IO::IOError(errno, "ioctl error on device", P_SOURCEINFO); } +void CdRomDevice::closeTray() throw (IO::IOError) { + int ret = ::ioctl((int)handle(), CDROMEJECT); + if(ret == -1) + throw IO::IOError(errno, "ioctl CDROMCLOSETRAY failed.", P_SOURCEINFO); +} + void CdRomDevice::pause() throw(IO::IOError) { int ret = ::ioctl((int)handle(), CDROMPAUSE); |
From: Marc D. <ma...@us...> - 2005-02-14 16:38:55
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1487/include/pclasses/System Modified Files: CdRomDevice.h Log Message: added close tray method to CdRomDevice Index: CdRomDevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/CdRomDevice.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CdRomDevice.h 14 Feb 2005 16:33:34 -0000 1.3 +++ CdRomDevice.h 14 Feb 2005 16:38:46 -0000 1.4 @@ -77,6 +77,8 @@ //! Eject media void eject() throw(IO::IOError); + + void closeTray() throw (IO::IOError); //! Read TOC (track-list) TrackList readTOC() throw(IO::IOError); |
From: Marc D. <ma...@us...> - 2005-02-14 16:33:46
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31595/src/System Modified Files: CdRomDevice.linux.cpp Log Message: added support for drive capabilities Index: CdRomDevice.linux.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/CdRomDevice.linux.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CdRomDevice.linux.cpp 1 Feb 2005 00:14:34 -0000 1.2 +++ CdRomDevice.linux.cpp 14 Feb 2005 16:33:35 -0000 1.3 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005 by Christian Prochnow * - * cp...@se... * + * Copyright (C) 2005 by Christian Prochnow (cp...@se...) * + * Copyright (C) 2005 by Marc Boris Dürner * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * @@ -37,6 +37,34 @@ { } +CdRomDevice::DriveCapability CdRomDevice::capability() throw(IO::IOError) +{ + CdRomDevice::DriveCapability capability = CdRom; + + int ret = ::ioctl((int)handle(), CDROM_GET_CAPABILITY, CDSL_CURRENT); + if(-1 == ret) { + throw IO::IOError(errno, "ioctl CDROM_GET_CAPABILITY failed.", P_SOURCEINFO); + } + + if(ret & CDC_CD_R) { + capability = static_cast<DriveCapability>(capability | CdRomDevice::CdRom); + } + if(ret & CDC_CD_RW) { + capability = static_cast<DriveCapability>(capability | CdRomDevice::CdRw); + } + if(ret & CDC_DVD) { + capability = static_cast<DriveCapability>(capability | DvdRom); + } + if(ret & CDC_DVD_R) { + capability = static_cast<DriveCapability>(capability | DvdR); + } + if(ret & CDC_DVD_RAM) { + capability = static_cast<DriveCapability>(capability | DvdRam); + } + + return capability; +} + CdRomDevice::DriveStatus CdRomDevice::driveStatus() throw(IO::IOError) { int ret = ::ioctl((int)handle(), CDROM_DRIVE_STATUS, CDSL_CURRENT); |
From: Marc D. <ma...@us...> - 2005-02-14 16:33:44
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31595/include/pclasses/System Modified Files: CdRomDevice.h Log Message: added support for drive capabilities Index: CdRomDevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/CdRomDevice.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CdRomDevice.h 1 Feb 2005 00:14:34 -0000 1.2 +++ CdRomDevice.h 14 Feb 2005 16:33:34 -0000 1.3 @@ -1,7 +1,7 @@ /*************************************************************************** - * Copyright (C) 2005 by Christian Prochnow * - * cp...@se... * - * * + * Copyright (C) 2005 by Christian Prochnow (cp...@se...) * + * Copyright (C) 2005 by Marc Boris Dürner * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * @@ -32,6 +32,14 @@ //! CD-ROM device class PSYSTEM_EXPORT CdRomDevice: public StorageDevice { public: + enum DriveCapability { + CdRom, + CdRw, + DvdRom, + DvdR, + DvdRam + }; + enum DriveStatus { NoInfo, NoDisc, @@ -60,7 +68,9 @@ ShareMode share) throw(IO::IOError); ~CdRomDevice() throw(); - + + DriveCapability capability() throw(IO::IOError); + DriveStatus driveStatus() throw(IO::IOError); DiscStatus discStatus() throw(IO::IOError); |
From: Christian P. <cp...@us...> - 2005-02-11 12:24:46
|
Update of /cvsroot/pclasses/pclasses2/src/App In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12997/src/App Modified Files: SimpleApp.cpp Log Message: Adding non-racy signal support... Index: SimpleApp.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/App/SimpleApp.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SimpleApp.cpp 10 Feb 2005 19:18:36 -0000 1.3 +++ SimpleApp.cpp 11 Feb 2005 12:24:20 -0000 1.4 @@ -22,6 +22,10 @@ #include "pclasses/App/SimpleApp.h" #include <signal.h> +#ifndef WIN32 +# include "../System/FdListener.h" +#endif + namespace P { namespace App { @@ -70,6 +74,9 @@ } #endif + System::EventQueue& evq = System::EventQueue::instance(); + System::FdListenerList& lst = System::FdListenerList::instance(evq); + #ifdef SIGTERM ::signal(SIGTERM, &signalHandler); #endif |
From: Christian P. <cp...@us...> - 2005-02-11 12:00:19
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4090/src/System Modified Files: EventQueue.cpp FdListener.posix.cpp Log Message: Added missing export-macros. Made write-end of wakeup-pipe also non-blocking. Index: FdListener.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/FdListener.posix.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- FdListener.posix.cpp 10 Feb 2005 19:13:42 -0000 1.2 +++ FdListener.posix.cpp 11 Feb 2005 12:00:09 -0000 1.3 @@ -98,7 +98,9 @@ if(ret == -1) throw SystemError(errno, "Could not create wakeup pipe", P_SOURCEINFO); + // make pipe nonblocking ... ::fcntl(_wakeupPipe[0], F_SETFL, O_NONBLOCK); + ::fcntl(_wakeupPipe[1], F_SETFL, O_NONBLOCK); _wakeupListener = new WakeupListener(_wakeupPipe[0]); _listeners.insert(_wakeupListener); @@ -210,7 +212,7 @@ Private::get_timeout(&timeout, timeout_ms, Private::TIMEOUT_RELATIVE); int ret = ::select(highest_fd + 1, &read_fds, &write_fds, &error_fds, - &timeout); + &timeout); if(ret == -1) { Index: EventQueue.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/EventQueue.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EventQueue.cpp 10 Feb 2005 19:13:43 -0000 1.2 +++ EventQueue.cpp 11 Feb 2005 12:00:09 -0000 1.3 @@ -81,7 +81,9 @@ EventQueue::EventQueue() { +#ifndef WIN32 _private = (void*)&FdListenerList::instance(*this); +#endif } EventQueue::~EventQueue() @@ -98,9 +100,11 @@ CriticalSection::ScopedLock lck(_eventQueueCs); _eventQueue.push(ev); +#ifndef WIN32 // wakeup the FdListener FdListenerList* lst = (FdListenerList*)_private; lst->wakeup(); +#endif } void EventQueue::wait(Event& ev) @@ -113,10 +117,12 @@ _eventQueueCs.lock(); if(_eventQueue.empty()) { - FdListenerList* lst = (FdListenerList*)_private; _eventQueueCs.unlock(); +#ifndef WIN32 + FdListenerList* lst = (FdListenerList*)_private; lst->wait(100000); +#endif _eventQueueCs.lock(); if(_eventQueue.empty()) |
From: Christian P. <cp...@us...> - 2005-02-11 12:00:18
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4090/include/pclasses/System Modified Files: EventQueue.h Log Message: Added missing export-macros. Made write-end of wakeup-pipe also non-blocking. Index: EventQueue.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/EventQueue.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EventQueue.h 10 Feb 2005 19:13:44 -0000 1.2 +++ EventQueue.h 11 Feb 2005 12:00:06 -0000 1.3 @@ -21,6 +21,7 @@ #ifndef P_System_EventLoop_h #define P_System_EventLoop_h +#include <pclasses/Export.h> #include <pclasses/NonCopyable.h> #include <pclasses/System/ThreadKey.h> #include <pclasses/System/CriticalSection.h> @@ -31,7 +32,7 @@ namespace System { -class Event { +class PSYSTEM_EXPORT Event { public: Event(void* sender = 0, unsigned int id = 0); ~Event(); @@ -47,7 +48,7 @@ class EventQueue; //! Event listener base-class -class EventListener { +class PSYSTEM_EXPORT EventListener { public: friend class EventQueue; @@ -72,7 +73,7 @@ Events. Each thread has it's own EventQueue that is created on the first call to EventQueue::instance(). */ -class EventQueue: public NonCopyable { +class PSYSTEM_EXPORT EventQueue: public NonCopyable { public: friend class EventListener; |
From: Christian P. <cp...@us...> - 2005-02-10 19:19:24
|
Update of /cvsroot/pclasses/pclasses2/src/Net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5009/src/Net Modified Files: Makefile.am Log Message: Added ServerSocketManager.cpp Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Net/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile.am 17 Jan 2005 22:50:36 -0000 1.6 +++ Makefile.am 10 Feb 2005 19:19:13 -0000 1.7 @@ -14,6 +14,7 @@ libpclasses_net_la_LDFLAGS = -no-undefined libpclasses_net_la_SOURCES = Socket.cpp NetworkAddress.cpp InetAddress.cpp \ - InetSocket.cpp HTTPHeader.cpp HTTPClient.cpp RTSPHeader.cpp RTSPSocket.cpp + InetSocket.cpp ServerSocketManager.cpp HTTPHeader.cpp HTTPClient.cpp \ + RTSPHeader.cpp RTSPSocket.cpp noinst_HEADERS = SocketOption.h |
From: Christian P. <cp...@us...> - 2005-02-10 19:18:45
|
Update of /cvsroot/pclasses/pclasses2/src/App In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4748/src/App Modified Files: SimpleApp.cpp Log Message: Added Event-dispatching to SimpleApp::main(). Index: SimpleApp.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/App/SimpleApp.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SimpleApp.cpp 18 Jan 2005 17:52:24 -0000 1.2 +++ SimpleApp.cpp 10 Feb 2005 19:18:36 -0000 1.3 @@ -18,9 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "pclasses/System/EventQueue.h" #include "pclasses/App/SimpleApp.h" #include <signal.h> - + namespace P { namespace App { @@ -84,7 +85,15 @@ int SimpleApp::main() { - _exitSem.wait(); + System::EventQueue& evq = System::EventQueue::instance(); + System::Event ev; + + while(!_exitSem.tryWait()) + { + evq.wait(ev); + evq.dispatch(ev); + } + return _exitCode; } @@ -92,6 +101,9 @@ { _exitCode = code; _exitSem.post(); + + System::EventQueue& evq = System::EventQueue::instance(); + evq.post(System::Event()); } void SimpleApp::cleanup() |
From: Christian P. <cp...@us...> - 2005-02-10 19:14:28
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2439/src/System Modified Files: FdListener.h FdListener.posix.cpp EventQueue.cpp Log Message: Renamed FdListenerThread -> FdListenerList. Waiting for signaled Fd's is now done by the EventQueue - not by a seperate Thread. Added Socket::setBlocking(bool). Index: FdListener.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/FdListener.posix.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FdListener.posix.cpp 7 Feb 2005 18:41:07 -0000 1.1 +++ FdListener.posix.cpp 10 Feb 2005 19:13:42 -0000 1.2 @@ -83,11 +83,15 @@ } }; +typedef std::map< + EventQueue*, + FdListenerList* +> InstMap; -FdListenerThread* FdListenerThread::_theThread = 0; +InstMap FdListenerList::_theLists; -FdListenerThread::FdListenerThread() throw(SystemError) -: Thread(true), _shouldExit(false) +FdListenerList::FdListenerList(EventQueue& evq) throw(SystemError) +: _eventQueue(evq) { // we use a pipe for wakeup signaling ... int ret = ::pipe(_wakeupPipe); @@ -100,54 +104,50 @@ _listeners.insert(_wakeupListener); } -FdListenerThread::~FdListenerThread() throw() +FdListenerList::~FdListenerList() throw() { delete _wakeupListener; ::close(_wakeupPipe[0]); ::close(_wakeupPipe[1]); } -void FdListenerThread::addListener(FdListener* l) +void FdListenerList::addListener(FdListener* l) { CriticalSection::ScopedLock lck(_listenersCs); _listeners.insert(l); wakeup(); } -void FdListenerThread::removeListener(FdListener* l) +void FdListenerList::removeListener(FdListener* l) { CriticalSection::ScopedLock lck(_listenersCs); _listeners.erase(l); wakeup(); } -void FdListenerThread::stop() -{ - _shouldExit = true; - wakeup(); -} - -void FdListenerThread::wakeup() +void FdListenerList::wakeup() { ::write(_wakeupPipe[1], "W", 1); } -FdListenerThread& FdListenerThread::instance() +FdListenerList& FdListenerList::instance(EventQueue& evq) { static CriticalSection cs; CriticalSection::ScopedLock lck(cs); - if(!_theThread) + InstMap::const_iterator i = _theLists.find(&evq); + if(i == _theLists.end()) { - _theThread = new FdListenerThread(); - _theThread->start(); + FdListenerList* thread = new FdListenerList(evq); + _theLists.insert(std::make_pair(&evq, thread)); + return *thread; } - return *_theThread; + return *i->second; } int populate_fd_sets(fd_set* read_fds, fd_set* write_fds, fd_set* error_fds, - FdListenerThread::ListenerSet& l) + FdListenerList::ListenerSet& l) { int highest_fd = 0; int num_read_fds = 0, num_write_fds = 0, num_error_fds = 0; @@ -156,7 +156,7 @@ FD_ZERO(write_fds); FD_ZERO(error_fds); - for(FdListenerThread::ListenerSet::const_iterator i = l.begin(); + for(FdListenerList::ListenerSet::const_iterator i = l.begin(); i != l.end(); ++i) { FdListener* listener = *i; @@ -194,68 +194,61 @@ return highest_fd; } -int FdListenerThread::main() +void FdListenerList::wait(unsigned int timeout_ms) { fd_set read_fds, write_fds, error_fds; struct timeval timeout; - unsigned int timeout_ms = 0; - while(!_shouldExit) + int highest_fd; { - int highest_fd; - { - CriticalSection::ScopedLock lck(_listenersCs); + CriticalSection::ScopedLock lck(_listenersCs); - highest_fd = - populate_fd_sets(&read_fds, &write_fds, &error_fds, _listeners); - } + highest_fd = + populate_fd_sets(&read_fds, &write_fds, &error_fds, _listeners); + } - Private::get_timeout(&timeout, timeout_ms, Private::TIMEOUT_RELATIVE); + Private::get_timeout(&timeout, timeout_ms, Private::TIMEOUT_RELATIVE); - int ret = ::select(highest_fd + 1, &read_fds, &write_fds, &error_fds, - &timeout); + int ret = ::select(highest_fd + 1, &read_fds, &write_fds, &error_fds, + &timeout); - if(ret == -1) - { - //@@fixme ... we don't want to throw from Thread::main() !!! - throw SystemError(errno, "Could not select() for events", P_SOURCEINFO); - } - else if(ret) + if(ret == -1) + { + //@@fixme ... we don't want to throw from Thread::main() !!! + throw SystemError(errno, "Could not select() for events", P_SOURCEINFO); + } + else if(ret) + { + // i think we can hold the lock when dispatching the events ... + CriticalSection::ScopedLock lck(_listenersCs); + + for(ListenerSet::const_iterator i = _listeners.begin(); + i != _listeners.end(); ++i) { - // i think we can hold the lock when dispatching the events ... - CriticalSection::ScopedLock lck(_listenersCs); + FdListener* l = *i; + int fd = l->fd(); + int flags = l->flags(); - for(ListenerSet::const_iterator i = _listeners.begin(); - i != _listeners.end(); ++i) + if(flags & FdListener::Read && FD_ISSET(fd, &read_fds)) { - FdListener* l = *i; - int fd = l->fd(); - int flags = l->flags(); - - if(flags & FdListener::Read && FD_ISSET(fd, &read_fds)) - { - flags &= ~FdListener::Read; - l->onRead(); - } - if(flags & FdListener::Write && FD_ISSET(fd, &write_fds)) - { - flags &= ~FdListener::Write; - l->onWrite(); - } - if(flags & FdListener::Error && FD_ISSET(fd, &error_fds)) - { - flags &= ~FdListener::Error; - l->onError(); - } - - if(flags != l->flags()) - l->setFlags(flags); + flags &= ~FdListener::Read; + l->onRead(); } + if(flags & FdListener::Write && FD_ISSET(fd, &write_fds)) + { + flags &= ~FdListener::Write; + l->onWrite(); + } + if(flags & FdListener::Error && FD_ISSET(fd, &error_fds)) + { + flags &= ~FdListener::Error; + l->onError(); + } + + if(flags != l->flags()) + l->setFlags(flags); } } - - delete this; - return 0; } Index: FdListener.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/FdListener.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FdListener.h 7 Feb 2005 18:41:07 -0000 1.1 +++ FdListener.h 10 Feb 2005 19:13:42 -0000 1.2 @@ -21,10 +21,10 @@ #ifndef P_System_FdListener_h #define P_System_FdListener_h -#include "pclasses/System/Thread.h" #include "pclasses/System/CriticalSection.h" #include "pclasses/System/SystemError.h" #include <set> +#include <map> namespace P { @@ -32,7 +32,7 @@ class PSYSTEM_EXPORT FdListener { public: - friend class FdListenerThread; + friend class FdListenerList; enum Flags { Read = 0x01, @@ -58,7 +58,9 @@ int _flags; }; -class PSYSTEM_EXPORT FdListenerThread: private Thread { +class EventQueue; + +class PSYSTEM_EXPORT FdListenerList { public: typedef std::set<FdListener*> ListenerSet; @@ -66,24 +68,26 @@ void removeListener(FdListener* l); void wakeup(); - void stop(); - static FdListenerThread& instance(); + void wait(unsigned int timeout); - private: - FdListenerThread() throw(SystemError); - ~FdListenerThread() throw(); + static FdListenerList& instance(EventQueue& evq); - int main(); + private: + FdListenerList(EventQueue& evq) throw(SystemError); + ~FdListenerList() throw(); - volatile bool _shouldExit; int _wakeupPipe[2]; FdListener* _wakeupListener; + EventQueue& _eventQueue; ListenerSet _listeners; CriticalSection _listenersCs; - static FdListenerThread* _theThread; + static std::map< + EventQueue*, + FdListenerList* + > _theLists; }; Index: EventQueue.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/EventQueue.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- EventQueue.cpp 7 Feb 2005 18:41:06 -0000 1.1 +++ EventQueue.cpp 10 Feb 2005 19:13:43 -0000 1.2 @@ -21,6 +21,10 @@ #include "pclasses/System/EventQueue.h" #include <set> +#ifndef WIN32 +# include "FdListener.h" +#endif + namespace P { namespace System { @@ -76,55 +80,66 @@ ThreadKey<EventQueue> EventQueue::_theQueues; EventQueue::EventQueue() -: _eventQMutex(), _eventQCond(_eventQMutex) { + _private = (void*)&FdListenerList::instance(*this); } EventQueue::~EventQueue() { } +void EventQueue::send(const Event& ev) +{ + dispatch(ev); +} + void EventQueue::post(const Event& ev) { - Mutex::ScopedLock lck(_eventQMutex); + CriticalSection::ScopedLock lck(_eventQueueCs); _eventQueue.push(ev); - _eventQCond.signal(); + + // wakeup the FdListener + FdListenerList* lst = (FdListenerList*)_private; + lst->wakeup(); } void EventQueue::wait(Event& ev) { - Mutex::ScopedLock lck(_eventQMutex); - while(_eventQueue.empty()) - _eventQCond.wait(lck); - - ev = _eventQueue.front(); - _eventQueue.pop(); + while(!tryWait(ev, 100000)); } bool EventQueue::tryWait(Event& ev, unsigned int timeout) { - Mutex::ScopedLock lck(_eventQMutex); - + _eventQueueCs.lock(); if(_eventQueue.empty()) { - if(!_eventQCond.tryWait(lck, timeout) - || _eventQueue.empty()) + FdListenerList* lst = (FdListenerList*)_private; + _eventQueueCs.unlock(); + + lst->wait(100000); + + _eventQueueCs.lock(); + if(_eventQueue.empty()) + { return false; + _eventQueueCs.unlock(); + } } ev = _eventQueue.front(); _eventQueue.pop(); - return true; + _eventQueueCs.unlock(); + return true; } void EventQueue::dispatch(const Event& ev) { // we should call the EventListener's without held mutex lock, since a // signaled EventListener may modify our list of listeners. - std::set<EventListener*> _dispatchers; + std::set<EventListener*> dispatchers; // we need exclusive access to the multimap ... - _listenersMutex.lock(); + _listenersCs.lock(); std::pair<ListenerMap::iterator, ListenerMap::iterator> p = _listeners.equal_range(ev.sender()); @@ -133,16 +148,16 @@ while(p.first != p.second) { EventListener* l = (*p.first).second; - _dispatchers.insert(l); + dispatchers.insert(l); ++p.first; } // unlock the mutex - _listenersMutex.unlock(); + _listenersCs.unlock(); // now notify all EventListener's without held lock - std::set<EventListener*>::iterator i = _dispatchers.begin(); - while(i != _dispatchers.end()) + std::set<EventListener*>::iterator i = dispatchers.begin(); + while(i != dispatchers.end()) { (*i)->signaled(ev); ++i; @@ -151,13 +166,13 @@ void EventQueue::addListener(EventListener* l) { - Mutex::ScopedLock lck(_listenersMutex); + CriticalSection::ScopedLock lck(_listenersCs); _listeners.insert(std::make_pair(l->sender(), l)); } void EventQueue::removeListener(EventListener* l) { - Mutex::ScopedLock lck(_listenersMutex); + CriticalSection::ScopedLock lck(_listenersCs); std::pair<ListenerMap::iterator, ListenerMap::iterator> p = _listeners.equal_range(l->sender()); |
From: Christian P. <cp...@us...> - 2005-02-10 19:14:00
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2439/include/pclasses/Net Modified Files: Makefile.am Socket.h Log Message: Renamed FdListenerThread -> FdListenerList. Waiting for signaled Fd's is now done by the EventQueue - not by a seperate Thread. Added Socket::setBlocking(bool). Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Net/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 16 Jan 2005 00:08:08 -0000 1.4 +++ Makefile.am 10 Feb 2005 19:13:45 -0000 1.5 @@ -2,5 +2,6 @@ INCLUDES = METASOURCES = AUTO -pclasses_net_include_HEADERS = NetworkAddress.h Socket.h InetAddress.h InetSocket.h \ - HTTPHeader.h HTTPClient.h RTSPHeader.h RTSPSocket.h RTSPSession.h +pclasses_net_include_HEADERS = NetworkAddress.h Socket.h InetAddress.h \ + InetSocket.h ServerSocketManager.h HTTPHeader.h HTTPClient.h RTSPHeader.h \ + RTSPSocket.h RTSPSession.h Index: Socket.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Net/Socket.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Socket.h 7 Feb 2005 18:47:13 -0000 1.7 +++ Socket.h 10 Feb 2005 19:13:46 -0000 1.8 @@ -89,6 +89,8 @@ void setRouting(bool enable) throw(IO::IOError); + void setBlocking(bool enable) throw(IO::IOError); + int wait(int wait, unsigned int timeout) throw(IO::IOError); static int wait(Socket* s[], int wait[], int num, unsigned int timeout) |
From: Christian P. <cp...@us...> - 2005-02-10 19:14:00
|
Update of /cvsroot/pclasses/pclasses2/src/Net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2439/src/Net Modified Files: Socket.cpp Log Message: Renamed FdListenerThread -> FdListenerList. Waiting for signaled Fd's is now done by the EventQueue - not by a seperate Thread. Added Socket::setBlocking(bool). Index: Socket.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Net/Socket.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Socket.cpp 7 Feb 2005 18:47:13 -0000 1.8 +++ Socket.cpp 10 Feb 2005 19:13:45 -0000 1.9 @@ -27,6 +27,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> +#include <fcntl.h> #include <errno.h> #include <netinet/in.h> @@ -462,6 +463,25 @@ opt.set(enable ? 1 : 0); } +void Socket::setBlocking(bool enable) throw(IO::IOError) +{ + int ret; + ret = ::fcntl(handle(), F_GETFL); + if(ret == -1) + throw IO::IOError(errno, "Could not get file-descriptor flags", + P_SOURCEINFO); + + long flags = ret; + if(enable) + ret |= O_NONBLOCK; + else + ret &= ~O_NONBLOCK; + + ret = ::fcntl(handle(), F_SETFL, flags); + throw IO::IOError(errno, "Could not get file-descriptor flags", + P_SOURCEINFO); +} + int Socket::handle() const throw() { return _handle; @@ -600,31 +620,34 @@ SocketFdListener(SocketListener* listener, int fd, int flags) : System::FdListener(fd, flags), _listener(listener) { - System::FdListenerThread& thr = System::FdListenerThread::instance(); - thr.addListener(this); + System::FdListenerList& lst = + System::FdListenerList::instance(_listener->eventQueue()); + + lst.addListener(this); } ~SocketFdListener() { - System::FdListenerThread& thr = System::FdListenerThread::instance(); - thr.removeListener(this); + System::FdListenerList& lst = + System::FdListenerList::instance(_listener->eventQueue()); + lst.removeListener(this); } void onRead() { - _listener->eventQueue().post( + _listener->eventQueue().send( System::Event(_listener->sender(), SocketEventRead)); } void onWrite() { - _listener->eventQueue().post( + _listener->eventQueue().send( System::Event(_listener->sender(), SocketEventWrite)); } void onError() { - _listener->eventQueue().post( + _listener->eventQueue().send( System::Event(_listener->sender(), SocketEventError)); } @@ -667,8 +690,8 @@ ((SocketFdListener*)_handle)->setFlags(mask); // Wakeup the thread so it can get the new event flags ... - System::FdListenerThread& thr = System::FdListenerThread::instance(); - thr.wakeup(); + System::FdListenerList& lst = System::FdListenerList::instance(eventQueue()); + lst.wakeup(); } int SocketListener::eventMask() const throw() |
From: Christian P. <cp...@us...> - 2005-02-10 19:13:59
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2439/include/pclasses/System Modified Files: EventQueue.h Log Message: Renamed FdListenerThread -> FdListenerList. Waiting for signaled Fd's is now done by the EventQueue - not by a seperate Thread. Added Socket::setBlocking(bool). Index: EventQueue.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/EventQueue.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- EventQueue.h 7 Feb 2005 18:41:06 -0000 1.1 +++ EventQueue.h 10 Feb 2005 19:13:44 -0000 1.2 @@ -23,8 +23,7 @@ #include <pclasses/NonCopyable.h> #include <pclasses/System/ThreadKey.h> -#include <pclasses/System/Mutex.h> -#include <pclasses/System/Condition.h> +#include <pclasses/System/CriticalSection.h> #include <map> #include <queue> @@ -86,6 +85,8 @@ //! Dispatch event void dispatch(const Event& ev); + void send(const Event& ev); + //! Post event to queue void post(const Event& ev); @@ -104,15 +105,15 @@ Event > _eventQueue; - Mutex _eventQMutex; - Condition _eventQCond; + CriticalSection _eventQueueCs; typedef std::multimap< void*, EventListener* > ListenerMap; - ListenerMap _listeners; - Mutex _listenersMutex; + ListenerMap _listeners; + CriticalSection _listenersCs; + void* _private; static ThreadKey<EventQueue> _theQueues; }; |