[patch] Break limitation of file watchers for KDirWatch on Windows

Jaroslaw Staniek js at iidea.pl
Thu Jul 10 18:23:14 BST 2008


Thiago Macieira said the following, On 2008-07-10 05:29:
> Jaroslaw Staniek wrote:
>> Thiago Macieira said the following, On 2008-07-09 22:43:
>>> Jaroslaw Staniek wrote:
>>>> Maximum number of wait objects per single QFileSystemWatcher is
>>>> MAXIMUM_WAIT_OBJECTS (64) on Windows.
>>> If it's a limitation of QFileSystemWatcher, shouldn't it be reported
>>> as a bug to that and fixed in Qt?
>> Qt/Windows contains explicit condition to only allow
>> MAXIMUM_WAIT_OBJECTS. I don't know what was the reason for this.
>>
>> If possible, I'd like to have the patch applied as a workaround and then
>> report the bug and monitor its resolution.
> 
> Well, maybe there's a reason such a limit exists then. And since you're 
> bypassing it, shouldn't you ask why it is there?
> 
> Anyways, go ahead and apply it if it helps.

I will.
Updated the note with a link to MSDN:

/* Helper implemented as a workaround for limitation on Windows:
  * the maximum number of object handles is MAXIMUM_WAIT_OBJECTS (64) per thread.
  *
  * From http://msdn.microsoft.com/en-us/library/ms687025(VS.85).aspx
  * "To wait on more than MAXIMUM_WAIT_OBJECTS handles, create a thread to wait
  *  on MAXIMUM_WAIT_OBJECTS handles, then wait on that thread plus the other 
handles.
  *  Use this technique to break the handles into groups of MAXIMUM_WAIT_OBJECTS."
  *
  * QFileSystemWatcher is implemented as thread, so KFileSystemWatcher
  * allocates more QFileSystemWatcher instances on demand (and deallocates 
them later).
  */

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)




More information about the kde-core-devel mailing list