• Advertisement

Archived

This topic is now archived and is closed to further replies.

enqueue

This topic is 5458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello All I have a enqueue function. When I try to read the data in message struct using a head pointer, it can''t read the data. However, when I use the tail pointer, it works fine Why??? Please help Thanks void timeout_enqueue(MSG_ENV *message) { if(timeout_q.head == NULL) { timeout_q.head = message; timeout_q.tail = message; } else if(timeout_q.head != NULL) { timeout_q.tail->ptr = message; timeout_q.tail = message; } }

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
That''s a whole lot of info..

If I had to make a hazard quess, you''re not initializing head->ptr but you''re initializing tail->ptr

Share this post


Link to post
Share on other sites
How can I make sure that I initialized my head and tail?
I thought
timeoutq.head = message
and
timeoutq.tail = message
will take care of that

Share this post


Link to post
Share on other sites

  • Advertisement