Re: pthreads slows computer & kills program
- From: Jerry Peters <jerry@xxxxxxxxxxxxxxx>
- Date: Sun, 27 Apr 2008 20:13:22 GMT
Ian Semmel <anyone@xxxxxxxxxxxxxxxxx> wrote:
You might lost the attitude. You're _asking_ people to help you with
"Rainer Weikusat" <rweikusat@xxxxxxxxxxx> wrote in message
news:87abjfmq2s.fsf@xxxxxxxxxxxxxxxxx:
"Ian Semmel" <anyone@xxxxxxxxxxxxxxxxx> writes:
[...]
If you read my post, you might see what the real question was.
Quoting this:
,----
| I basically have
|
| pthread_mutex_init ( & mutex, 0 );
| pthread_cond_init ( & cond, 0 );
| pthread_mutex_lock ( & mutex );
| cerr << "Ready to call cond_wait" << endl; // does this
| pthread_cond_wait(& cond, & mutex);
| cerr << "Got past cond_wait " << rc << endl; // doesn't get here
|
| Computer just slows down and eventually a 'Killed' message is displayed
`----
Expanded into something which actually compiles:
#include <pthread.h>
#include <stdio.h>
int main(void)
{
pthread_mutex_t mutex;
pthread_cond_t cond;
int rc;
pthread_mutex_init ( & mutex, 0 );
pthread_cond_init ( & cond, 0 );
pthread_mutex_lock ( & mutex );
fputs("Ready to call cond_wait\n", stderr);
rc = pthread_cond_wait(& cond, & mutex);
fprintf(stderr, "Got past cond wait: %d\n", rc);
return 0;
}
Compiling this with gcc a.c -lpthread yields an exectuable which just
blocks, consuming no CPU time at all.
Conclusion: Your problem is that you believe to be suffering harmful
effects caused by phenomena which are demonstrably absent. Consider
consulting a psychatrist.
HTH.
Well, that is what it is supposed to do until it is signalled. It is in
a thread.
I suppose I could have included the 12000 lines or so of the program in
the post but I thought I was dealing with experienced programmers.
I should have known better.
your problem, they aren't getting _paid_ to help you, and you haven't
asked a recognizable question, just posted some code with prceious
little explanation. I'd suggest you actually _read_ some of the
references on how to ask an _intelligent_ question.
Jerry
.
- References:
- Re: pthreads slows computer & kills program
- From: Rainer Weikusat
- Re: pthreads slows computer & kills program
- From: Ian Semmel
- Re: pthreads slows computer & kills program
- Prev by Date: Re: pthreads slows computer & kills program
- Next by Date: Cheap Technomarine Watches Jubilee Watches - Technomarine Watches Jubilee Watch Cheapest
- Previous by thread: Re: pthreads slows computer & kills program
- Next by thread: Re: pthreads slows computer & kills program
- Index(es):
Relevant Pages
|