| View previous topic :: View next topic |
| Author |
Message |
Andrea Guest
|
Posted: Thu Mar 04, 2004 6:57 pm Post subject: how to stop a work in progres? |
|
|
Hi!
If I am downloading a long message with attachments with tidpop3.retrieve,
what can be a solution to permit the user to stop the work in progres if eh
changes his mind about downloading it?
Thanks
Andrea
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Thu Mar 04, 2004 7:38 pm Post subject: Re: how to stop a work in progres? |
|
|
"Andrea" <andrearo (AT) tin (DOT) it> wrote in news:40477c2a (AT) newsgroups (DOT) borland.com:
| Quote: | If I am downloading a long message with attachments with tidpop3.retrieve,
what can be a solution to permit the user to stop the work in progres if eh
changes his mind about downloading it?
|
Close the socket from another thread, or use an Antifreeze and close it from
an event.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Want more Indy stuff? Try the Atozed Indy Portal at
http://www.atozedsoftware.com/
* More Free Demos
* Free Articles
* Extra Support
|
|
| Back to top |
|
 |
Admiral Jake Guest
|
Posted: Thu Mar 04, 2004 11:33 pm Post subject: Re: how to stop a work in progres? |
|
|
"Chad Z. Hower aka Kudzu" <cpub (AT) hower (DOT) org> wrote
| Quote: | Close the socket from another thread
|
How does one do this is a truly threadsafe manner? My experience with
multithreading is that if you access any resource from multiple threads it
had better be threadsafe or protected by a synchronization object like a
TCriticalSection, or all heck is going to break loose in an annoyingly
irreproducible manner. How do you suggest that references to an Indy object
be passed between threads so that one thread can be interrupted by a line
like this:
IdNNTP1.Disconnect;
from another thread?
The reason I ask this is because I need to provide a graceful way for users
to cut short long or stalled activties, and I can't put off this
functionality any more, being in early beta now and only months away from
release.
|
|
| Back to top |
|
 |
Andrea Guest
|
Posted: Thu Mar 04, 2004 11:34 pm Post subject: Re: how to stop a work in progres? |
|
|
Ok, close it from another event... can you suggest me how to close it?
Thanks
Andrea
"Chad Z. Hower aka Kudzu" <cpub (AT) hower (DOT) org> ha scritto nel messaggio
news:Xns94A2DC3698E8Fcpub (AT) 127 (DOT) 0.0.1...
| Quote: | "Andrea" <andrearo (AT) tin (DOT) it> wrote in news:40477c2a (AT) newsgroups (DOT) borland.com:
If I am downloading a long message with attachments with
tidpop3.retrieve,
what can be a solution to permit the user to stop the work in progres if
eh
changes his mind about downloading it?
Close the socket from another thread, or use an Antifreeze and close it
from
an event.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Want more Indy stuff? Try the Atozed Indy Portal at
http://www.atozedsoftware.com/
* More Free Demos
* Free Articles
* Extra Support
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Mar 05, 2004 12:37 am Post subject: Re: how to stop a work in progres? |
|
|
"Admiral Jake" <johnjac76[nospam]@comcast.net> wrote
| Quote: | How does one do this is a truly threadsafe manner?
|
When closing the socket, call DisconnectSocket() instead of Disconnect() so
that no existing objects are freed. Disconnect() frees the IOHandler,
whereas DisconnectSocket() does not.
| Quote: | How do you suggest that references to an Indy object be passed
between threads so that one thread can be interrupted by a line
like this:
|
Sockets themselves are thread-safe internally. It is safe to close a socket
from one thread while another thread is still using the socket. The
operational thread will simply fail its current operation with an error that
the socket is no longer valid.
Gambit
|
|
| Back to top |
|
 |
M. Utku ALTINKAYA Guest
|
Posted: Fri Mar 05, 2004 8:52 am Post subject: Re: how to stop a work in progres? |
|
|
Ita not a alternative to closing socket bu maybe you can throw an exception onwork event
also. And catch it in execute method of your thread...
|
|
| Back to top |
|
 |
|