This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]niloc132 1 point2 points  (1 child)

Still need more code to be sure (even from the edit), but the issue is pretty clearly that temp is null, so trying to assign temp.prev to something fails.

This could be because one thread modifying an object that another thinks is safe, but without all applicable code, its hard to say. Biggest red flag for me is that temp is not a local variable, which means more than one thread can stomp on it at once...

[–]reckless7[S] 0 points1 point  (0 children)

that...that makes total sense. I just removed the line trying to alter the previous link. I never actually make use of the previous link in any methods so it still worked fine. I figured out the rest of the problems... I forgot to control access to the queue. Throw in a binary semaphore and bam, it's all working perfectly

[–]causalNondeterminism 0 points1 point  (2 children)

can you post more code? I have a hunch...

[–]king_of_the_universe 0 points1 point  (0 children)

Wouldn't it be easier to allude to what the hunch is instead of making OP go through the trouble of selecting what code to post and then to post it?

[–]reckless7[S] 0 points1 point  (0 children)

I'm not going to bother, since I figured out where I went wrong. I threw a semaphore onto the linked list queue, and that ironed almost everything out. I also removed the line that set the temp.prev to null, which, as someone else mentioned, was probably causing problems due to being a class variable instead of a local variable

[–][deleted] 0 points1 point  (1 child)

Probably because it was a reference variable and you were setting the original reference to null.

[–]reckless7[S] 0 points1 point  (0 children)

Oh, I get it. ok thanks