[Coldstuff] suspending tasks

Bruce Mitchener coldstuff@cold.org
Wed, 24 Jul 2002 10:12:57 -0600


Jeremy Lowery wrote:
> I?ve written a web server that runs on genesis and when a client 
> downloads a file from the server, the entire server stops responding 
> until the file is downloaded. I do not know a lot about tasks and 
> execution stacks in Cold, but would there be a way to preempt the 
> execution to allow other requests some CPU time?

Don't use cwritef() or whatever it was that dumps the file to the 
connection in one shot.  Open the file, read from it, write the data to 
the network, and loop on that with a pause() in there.  You'll have to 
come up with what you think is a good chunksize to write each iteration 
through the loop.

  - Bruce