2. TRY boost::thread - problem with worker as an inner class of a queue
Dear Moderator!
Yesterday I posted a mail to boost-users. I got a reply, that my mail
awaits moderation. That mail also contained a link. The link is dead since
yesterday evening. Which does usually mean that the mail was posted,
but it did not show up. I have enclosed the mail again below,
Thanks, Lars Kunert
The following attached (downsized) program implements a queue which
contains a single worker process. Int's that are pushed into the queue
are popped by
the worker and processed... The problem is, the program ends up with an
segmentation fault. Valgrind tells me that the stack is overwritten.
==4927== Conditional jump or move depends on uninitialised value(s)
==4927== at 0x8073536: strstr (in
/local/home/lkunert/projects/pg-build-4.0.3/src/cdag/threads/queue_error)
==4927== by 0x80609F5: pthread_initialize (smp.h:47)
==4927== by 0x80B2DE1: (within
/local/home/lkunert/projects/pg-build-4.0.3/src/cdag/threads/queue_error)
==4927== by 0x80480E8: (within
/local/home/lkunert/projects/pg-build-4.0.3/src/cdag/threads/queue_error)
==4927== by 0x80641A0: __libc_csu_init (in
/local/home/lkunert/projects/pg-build-4.0.3/src/cdag/threads/queue_error)
==4927== by 0x8063FC2: __libc_start_main (in
/local/home/lkunert/projects/pg-build-4.0.3/src/cdag/threads/queue_error)
==4927== by 0x8048120: ??? (start.S:102)
==4927==
==4927== Syscall param write(buf) points to uninitialised byte(s)
==4927== at 0x8063044: write (in
/local/home/lkunert/projects/pg-build-4.0.3/src/cdag/threads/queue_error)
==4927== by 0x804C241: boost::thread::thread(boost::function0
Lars Kunert wrote:
Dear Moderator!
Yesterday I posted a mail to boost-users. I got a reply, that my mail awaits moderation. That mail also contained a link. The link is dead since yesterday evening. Which does usually mean that the mail was posted, but it did not show up. I have enclosed the mail again below,
Thanks, Lars Kunert
The following attached (downsized) program implements a queue which contains a single worker process. Int's that are pushed into the queue are popped by the worker and processed... The problem is, the program ends up with an segmentation fault. Valgrind tells me that the stack is overwritten.
[...]
int main() { QueueError q;
q.push( 10 ); q.push( 9 ); q.push( 8 ); q.push( 7 ); q.push( 6 );
return 0;
You are exiting main, running the destructor of q, while your worker thread is still active.
};
participants (2)
-
Lars Kunert
-
Peter Dimov