I knew I should have mentioned this in the first message. But, yes I 
know.  The problem is, it never even gets to that section.  That 
message is never displayed on the screen so it seems the thread is 
never called.  

I just compiled and ran it in insight (gdb gui) and something 
interesting is showing.  The pthread_create causes a seg fault and 
the debugger cuts to assembly of cygwin1... Can someone try that 
code below, and tell me if it runs?... maybe it is my cygwin that is 
screwy (shouldn't be, I just d/l it two days ago, clean install)

--Eric


On 11 Jun 2004 at 8:16, Ainsley wrote:

> On Thu, Jun 10, 2004 at 04:44:20PM -0700, [EMAIL PROTECTED] wrote:
> > I am really having some troubles with running pthreads and winpcap together.  
> > I am pretty rusty on my C so maybe it is just my stupidity, but I keep getting
> > lockups and my program will not run.
> > 
> > Basically, what I am trying to do is start a thread that will send out some
> > packets once every few seconds.  While this thread is going the main program
> > calls the pcap_loop and is listening for certain replies.
> > 
> > Unfortunately, when I put the pthread_create call in the program and run it, 
> > it just locks up on that call(ran it in gdb).  I comment out that line and 
> > the listening part runs just fine.
> > 
> [snip]
> > =============== test.c =================
> > 
> > #include <pcap.h>
> > #include <remote-ext.h> 
> > #include <pthread.h>
> > 
> > void *test(void *blah)
> > {
> >   int done=0;    
> >   while(!done){
> >      printf("Who: %s\n", (char *)blah);
> >      sleep(5);
> >   }
> > }
> > 
> > int main(){
> >     pcap_if_t *alldevs;
> >     pcap_if_t *d;
> >     int inum;
> >     int i=0;
> >     pcap_t *adhandle;
> >     char errbuf[PCAP_ERRBUF_SIZE];
> > 
> >     pthread_t t1;
> >     pthread_create(&t1, NULL,&test,(void *)"numero uno");
> >     pthread_join(t1,NULL);
> 
> To join a thread means to wait for it to complete. Since nothing sets
> done in test(), your thread won't complete, so this thread will sit
> waiting here indefinitely. This has nothing to do with winpcap.
> 
> Hope that helps,
> Ainsley.
> 
> 
> ==================================================================
>  This is the WinPcap users list. It is archived at
>  http://www.mail-archive.com/[EMAIL PROTECTED]/
> 
>  To unsubscribe use 
>  mailto: [EMAIL PROTECTED]
> ==================================================================
> 




==================================================================
 This is the WinPcap users list. It is archived at
 http://www.mail-archive.com/[EMAIL PROTECTED]/

 To unsubscribe use 
 mailto: [EMAIL PROTECTED]
==================================================================

Reply via email to