Re: strange behaviour with pthread_cond_wait()

From: Giorgos Keramidas (keramida_at_linux.gr)
Date: 08/31/05

  • Next message: Daniel Eischen: "Re: strange behaviour with pthread_cond_wait()"
    Date: Wed, 31 Aug 2005 03:44:41 +0300
    To: Daniel Valencia <fetrovsky@yahoo.com>
    
    

    On 2005-08-30 17:35, Daniel Valencia <fetrovsky@yahoo.com> wrote:
    > Hello, everybody...
    >
    > I have this multithreaded program, and there are these two threads
    > that work together with a queue. The backend receive thread reads
    > packets and pushes them into the queue, while the frontend thread pops
    > them off the queue to hand them to the caller. This is an
    > implementation of a software switch.
    >
    > The issue is, i have this little piece of code in the thread which
    > actually performs the popping:

    This is not a complete, compilable program. It's usually much easier to
    track down problems by looking at a minimal example that exhibits the
    problem. Can you post one?

    > if( !_recvq.size() )
    > {
    > int e = pthread_cond_wait( &_thread_cond_recv,
    > &_thread_mutex_recv );
    >
    > if( e )
    > {
    > std::perror( "pthread_cond_wait" );
    > std::exit( e );
    > }
    > }
    >
    > pthread_mutex_lock( &_recvq_mutex );
    > p = _recvq.front();
    > _recvq.pop();
    > pthread_mutex_unlock( &_recvq_mutex );
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Daniel Eischen: "Re: strange behaviour with pthread_cond_wait()"

    Relevant Pages

    • strange behaviour with pthread_cond_wait()
      ... I have this multithreaded program, ... two threads that work together with a queue. ... Do You Yahoo!? ... Mail has the best spam protection around ...
      (freebsd-hackers)
    • Re: strange behaviour with pthread_cond_wait()
      ... On Tue, 30 Aug 2005, Daniel Valencia wrote: ... > I have this multithreaded program, ... > two threads that work together with a queue. ... And from the POSIX Spec (see ...
      (freebsd-hackers)
    • [ANN] stompserver 0.9.8 Released
      ... queues, queue monitoring, and basic authentication. ... Better load distribution between clients acknowledging messages after ... Monitoring support through a dedicated queue. ... There's still some cleanup to do and the dbm backend should be ...
      (comp.lang.ruby)
    • Re: SMTP queue
      ... the backend has nothing in the queue and should ... Do you know how to make them deliver to the backend server? ... I saw two folders Queue and BadMail on the frontend server. ...
      (microsoft.public.exchange.admin)
    • Re: Printing problem on AIX5.2 vs HPLJ4200
      ... If I take the file and print it on the printer using FTP ... define a printer queue and ... It does NOT pass the job to the backend as stdin. ... command-line flags. ...
      (comp.unix.aix)