On Fri, Aug 29, 2003 at 05:26:45PM +0100, Paul Warren wrote:
On Fri, Aug 29, 2003 at 05:13:02PM +0100, Chris Lightfoot wrote:
Try this patch: (not absolutely certain about the second parameter to pcap_dispatch; try 1 if -1 doesn't work)
diff -u -r1.44 iftop.c --- iftop.c 2003/05/20 21:14:37 1.44 +++ iftop.c 2003/08/29 16:10:06 @@ -528,7 +528,9 @@ /* packet_loop:
- Worker function for packet capture thread. */
void packet_loop(void* ptr) {
- pcap_loop(pd,-1,(pcap_handler)packet_handler,NULL);
- /* Make sure that this thread is cancellable. */
- while (pcap_dispatch(p, -1, (pcap_handler)packet_handler, NULL) != -1)
pcap_testcancel();
}
ITYM pthread_testcancel,
yes
and that'll nead the thread handle.
no, in fact.
(I should say that I don't recall being the one to put the PCAP stuff in a thread. I have a horror of threads anyway....)
No. I don't understand threads, but I managed to figure out just enough to get them to start in different threads. Obviously, I couldn't then figure out how to make the stop again - you fixed that bit, and therefore claim ownership of that functionality ;-) It may be far less broken than when you first touched it, but you were the last one to touch it...
gah. ok, fair enough.