Am 08.04.2012 09:38, schrieb Oliver Rath:
> Hi List,
>
> is it possible in tntnet to generate an action (i.e. copying a large
> file) in a way, that tntnet dont wait for the result?
>
> I.e I want to offer a link in a website, where someone can download a
> big file. tntnet should start a copy-action of this file (ok, it is a
> bit more complicated, which doesnt matter for the principial thing) to a
> downloadable place and not wait for the end of the copy until he sends
> the http-site to the client. If now the user wants to download the file,
> tntnet look for the status of the copy-prozess and sends then the file
> to the user, if the copy is finished.
>
> How can I realize this?
>
> Happy eastern!
>
> Oliver
Yes you can!
look at sdk/demos/backgroundjob. There is a example, how to use the
BackgroundWorker class. The BackgroundWorker implements a thread pool,
which is managed by tntnet and waits for background jobs.
In short: you must derive a class from tnt::BackgroundTask and implement
the virtual execute()-method. If you want to start such a task, create a
new one and put it into the background task queue using:
tnt::BackgroundWorker::it().runTask(new YourTaskObject());
The background worker takes ownership from the object and one of the
background threads calls the execute method.
Tommi
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general