C thread-mutex codes errors?

You should not use & when you already have a pointer. Change this.

You should not use & when you already have a pointer. Change this: // Set default condition pthread_mutex_init(&mut,NULL); // Question v // Condition for not null pthread_mutex_init(¬Null,NULL); // Question vi // Condition for not empty pthread_mutex_init(¬Empty,NULL); // Question vi to this: // Set default condition pthread_mutex_init(mut,NULL); // Question v // Condition for not null pthread_mutex_init(notNull,NULL); // Question vi // Condition for not empty pthread_mutex_init(notEmpty,NULL); // Question vi Pay attention to & I have put away. Mut is already a pointer, and making &mut is an attempt to get pointer to pointer to pthread_mutex_t.

Thanks. How about the question I - iv? Any idea?

– cecillia90 Dec 7 '10 at 14:17 you should remove '&' there also. In all places. – Vladimir Ivanov Dec 7 '10 at 14:34 alright sire, thank you =) – cecillia90 Dec 7 '10 at 14:49.

NotNull is written as notFull in two places. NotNull and notEmpty are condition variables not mutexes and should be initialised as such. No memory is allocated for notNull and URL1 may be better to declare queue as: typedef struct { int buf10; long head, tail; int full, empty; pthread_mutex_t mut; pthread_cond_t notFull; pthread_cond_t notEmpty; } queue; And then keep all the & characters.

This means you can malloc the whole lot with a single call. Lastly I think you mean while(que->full) not while(que>full).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions