Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I have certain issue regarding thread controlling.Let me first tell you the situation.
There is MFC dialog on which two command button exist one name CHECK other is CANCEL.
CHECK button basically PING certain IP address given by some text box.And cancel is just to close the dialog box as its basic feature.
In CHECK button click i have created and started a Thread and store that thread pointer to some MAP. And in thread function i have ping the IP for getting the status of the IP and display some message for IP up or down.
In CWnd::DestroyWindow() function i have closed the thread and cleaned the thread map.
Note: I need to store the threads in map for the multiple IPs ping.

Scenario : Suppose pinging command takes too much time for getting the status of IP. And some now Cancel button is pressed. Now thread is still running so it will wait for completion of thread due to which application waits for completion of current thread and do not allow further processing.
Question: Any suggestion about to kill the thread if it is known that now there is no requirement of thread's result. but i do not want to dismiss the synchronization of threads as it already exist.

Thank you
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900