Hi everyone,
There is a method called listen in the DcmStorageSCP class. If I call the method in my own sub thread and want to PROPERLY shut down the listening thread, how should I do? At least I can't find any related methods in this class. In fact, when mannually shutting down the thread, memory leaks will be caused.
Thanks for advance!
Stop the listening thread by using the DcmStorageSCP class
Moderator: Moderator Team
-
- Posts: 83
- Joined: Thu, 2009-03-19, 04:19
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Stop the listening thread by using the DcmStorageSCP cla
The base class DcmSCP provides a method for this purpose: DcmSCP::stopAfterCurrentAssociation()
-
- Posts: 83
- Joined: Thu, 2009-03-19, 04:19
Re: Stop the listening thread by using the DcmStorageSCP cla
Yes, I' ve check the codes in scp.cc, and I found that if the value returned by this function is False, there will be a infinite loop for listening. But if I want to manually terminate the loop, how do the network resources have to be released? In other words, sometimes I want to release the memory first and then drop the network.J. Riesmeier wrote:The base class DcmSCP provides a method for this purpose: DcmSCP::stopAfterCurrentAssociation()
For instance, the method listen is called in the sub thread named ListenThread which being made by myself, and when I terminate the thread, the listening process also being terminate, the memory leaks appear. (BTW, I use VC2010 and the object dumping is listed in the output window.)
If stopAfterCurrentAssociation return true, it will never step into the loop. As the listening process has already been started, it has to wait for some associations coming, or else stopAfterCurrentAssociation will never be called. If I want to terminate the loop immediately without waiting for associations, will waitForAssociation properly drop the network?
Sincerely!
Last edited by liuxinming on Wed, 2014-07-02, 05:55, edited 1 time in total.
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Stop the listening thread by using the DcmStorageSCP cla
Did you already check the threaded version of the DcmSCP (i.e. DcmSCPPool and associated classes)?
If stopAfterCurrentAssociation() does not meet your requirements, you should consider to overwrite further methods in your derived class, e.g. listen() or waitForAssociationRQ().
If stopAfterCurrentAssociation() does not meet your requirements, you should consider to overwrite further methods in your derived class, e.g. listen() or waitForAssociationRQ().
Who is online
Users browsing this forum: Bing [Bot] and 1 guest