<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>The limitation in using threads is the same one you have with
classes: you should not call the pcap_ functions on the *same* pcap_t handle
from multiple threads. You can safely use multiple threads each one dealing with
a different pcap_t handle.</FONT></DIV>
<DIV><FONT size=2>pcap_findalldevs is thread-safe, if it hangs then it's a
bug.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Have a nice day</FONT></DIV>
<DIV><FONT size=2>GV</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=hardik_nt@yahoo.com href="mailto:hardik_nt@yahoo.com">Hardik Shah</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=winpcap-users@winpcap.org
href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, April 20, 2007 9:19
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Winpcap-users] Re:
Winpcap-users Digest, Vol 25, Issue 14</DIV>
<DIV><BR></DIV>
<DIV style="FONT-SIZE: 8pt; FONT-FAMILY: verdana,helvetica,sans-serif">try
using entercriticalsection before starting anythread.if i m not wrong no two
thread can access the same stuff at kernel level.<BR>
<DIV> </DIV>--------------------------------<BR>
<DIV>Hardik Shah<BR><FONT size=3>mobile:- 9827634991</FONT><BR>phone:-
+91-0731-2570516 </DIV>
<DIV
style="FONT-SIZE: 8pt; FONT-FAMILY: verdana,helvetica,sans-serif"><BR><BR>
<DIV
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif">-----
Original Message ----<BR>From: "<A
href="mailto:winpcap-users-request@winpcap.org">winpcap-users-request@winpcap.org</A>"
<<A
href="mailto:winpcap-users-request@winpcap.org">winpcap-users-request@winpcap.org</A>><BR>To:
winpcap-users@winpcap.org<BR>Sent: Friday, 20 April, 2007 5:30:50
PM<BR>Subject: Winpcap-users Digest, Vol 25, Issue 14<BR><BR>
<DIV>Send Winpcap-users mailing list submissions
to<BR> winpcap-users@winpcap.org<BR><BR>To subscribe or
unsubscribe via the World Wide Web, visit<BR> <A
href="https://www.winpcap.org/mailman/listinfo/winpcap-users"
target=_blank>https://www.winpcap.org/mailman/listinfo/winpcap-users</A><BR>or,
via email, send a message with subject or body 'help'
to<BR> winpcap-users-request@winpcap.org<BR><BR>You can
reach the person managing the list
at<BR> winpcap-users-owner@winpcap.org<BR><BR>When
replying, please edit your Subject line so it is more specific<BR>than "Re:
Contents of Winpcap-users digest..."<BR><BR><BR>Today's
Topics:<BR><BR> 1. Problem with threading (Avelino
Martins)<BR><BR><BR>----------------------------------------------------------------------<BR><BR>Message:
1<BR>Date: Thu, 19 Apr 2007 21:18:42 +0000<BR>From: Avelino Martins
<martins_ajc@msn.com><BR>Subject: [Winpcap-users] Problem with
threading<BR>To: <winpcap-users@winpcap.org><BR>Message-ID:
<BAY117-W18EBF90F0362E266B52C688C570@phx.gbl><BR>Content-Type:
text/plain; charset="iso-8859-1"<BR><BR>Hello all, <BR>despite all the threads
i readed about issues on threading problems, i couldn't get to a conclusion at
the specific issue of the function <BR>pcap_findalldevs() hanging when called
from a child thread, take the simple example:<BR><BR>#include
<pcap.h><BR>#pragma comment(lib, "Wpcap.lib")<BR><BR>void
GetINetDevice()<BR>{<BR> pcap_if_t*
alldevs;<BR> char
errbuf[PCAP_ERRBUF_SIZE+1];<BR><BR> /* Retrieve the
device list */<BR> if(pcap_findalldevs(&alldevs,
errbuf) == -1)<BR>
{<BR> printf("Error
in pcap_findalldevs: %s\n",
errbuf);<BR> exit(1);<BR>
}<BR> // Could not create
thread<BR> MessageBox(NULL,
"Sucess","",MB_OK);<BR><BR> // Free the device list
<BR> pcap_freealldevs(alldevs);<BR>}<BR><BR><BR>int
main()<BR>{ <BR> DWORD
m_dwThreadID;<BR> HANDLE
m_hThread;<BR> m_hThread =
CreateThread(0,<BR>
0,<BR>
(LPTHREAD_START_ROUTINE)GetINetDevice,<BR>
NULL,<BR>
0,<BR>
&m_dwThreadID);<BR>
if(!m_hThread)<BR>
{<BR> // Could not
create
thread<BR> MessageBox(NULL,
"Thread error","",MB_OK);<BR>
}<BR> return 0;<BR>}<BR><BR>Is anyone able to tell me
if the fact of the app hangs/exits on pcap_findalldevs(), is a known issue at
winpcap, and if there is any workaround?<BR><BR>Best
Regards<BR>_________________________________________________________________<BR>Veja
mais. Partilhe mais. Experimente o Windows Live Messenger beta
gratuitamente<BR><A
href="http://ideas.live.com/programpage.aspx?versionId=0eccd94b-eb48-497c-8e60-c6313f7ebb73"
target=_blank>http://ideas.live.com/programpage.aspx?versionId=0eccd94b-eb48-497c-8e60-c6313f7ebb73</A><BR>--------------
next part --------------<BR>An HTML attachment was scrubbed...<BR>URL: <A
href="http://www.winpcap.org/pipermail/winpcap-users/attachments/20070419/d60d9c04/attachment.html"
target=_blank>http://www.winpcap.org/pipermail/winpcap-users/attachments/20070419/d60d9c04/attachment.html</A><BR><BR>------------------------------<BR><BR>_______________________________________________<BR>Winpcap-users
mailing list<BR>Winpcap-users@winpcap.org<BR><A
href="https://www.winpcap.org/mailman/listinfo/winpcap-users"
target=_blank>https://www.winpcap.org/mailman/listinfo/winpcap-users</A><BR><BR><BR>End
of Winpcap-users Digest, Vol 25, Issue
14<BR>*********************************************<BR></DIV></DIV><BR></DIV></DIV><BR>
<HR SIZE=1>
</HR>Check out what you're missing if you're not on <A
href="http://us.rd.yahoo.com/mail/in/ymessenger/*http://in.messenger.yahoo.com/">Yahoo!
Messenger</A>
<P>
<HR>
<P></P>_______________________________________________<BR>Winpcap-users
mailing
list<BR>Winpcap-users@winpcap.org<BR>https://www.winpcap.org/mailman/listinfo/winpcap-users<BR></BLOCKQUOTE></BODY></HTML>