Re: strange behaviour with pthread_cond_wait()
From: Giorgos Keramidas (keramida_at_linux.gr)
Date: 08/31/05
- Previous message: Daniel Valencia: "strange behaviour with pthread_cond_wait()"
- In reply to: Daniel Valencia: "strange behaviour with pthread_cond_wait()"
- Next in thread: Daniel Eischen: "Re: strange behaviour with pthread_cond_wait()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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"
- Previous message: Daniel Valencia: "strange behaviour with pthread_cond_wait()"
- In reply to: Daniel Valencia: "strange behaviour with pthread_cond_wait()"
- Next in thread: Daniel Eischen: "Re: strange behaviour with pthread_cond_wait()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|