|
Boost Users : |
From: Kevin Wheatley (hxpro_at_[hidden])
Date: 2005-06-20 05:26:57
Matthias Kaeppler wrote:
> 2. Check for a terminate flag once in a while and return from the method
> once it is set.
>
> But how am I supposed to do the latter? The copy function doesn't return
> until it's finished right? So I can't check for a condition, because the
> copy-thread itself is blocked until it's done.
I think 2 is the way to go. However you need to think about your
'copy' operation... why do you have to copy the whole file in one
function/system call? simply chop the file up into chunks and then it
gives you a point at which to test the status of a condition variable,
every 'X' bytes, you could even make 'X' user selectable, trading off
throughput vs latency of handling the UI request.
For free you then get to update your progress bar every so often
too...
Kevin
-- | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this | | Senior Technology | My employer for certain | | And Network Systems Architect | Not even myself |
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net