all authors of ioslaves: new wasKilled() for lengthy operations !

aleXXX alexander.neundorf at
Tue Jun 11 00:10:51 BST 2002


for all of you who wrote an ioslave:
I just commited a patch to kio/kio/slavebase.cpp, which adds a function 
This returns true if the slave has been killed. From this moment on you have 
5 seconds to cleanly exit your ioslave, i.e. to return from the function you 
are currently in, back to dispatchLoop(). If you don't check, your ioslave 
dtor will only be called if your slave is idle at this moment, if it is busy 
your dtor won't be called without this check !
Therefor add a check in all potential lengthy operations, like

void FooSlave::get()
  ... do stuff
  while (notAllDataReadYet)
      select(maxFd, &fds,0,0,%tv);
      if (wasKilled())
      int bytesRead=::read(fd,buf,bufsize);
      array.setRawData(buf, bytesRead);
      data( array );


More information about the kde-core-devel mailing list