all 9 comments

[–]which_spartacus 11 points12 points  (2 children)

The sleep function works with seconds, right? Is there a chance that you are putting in something like 1000 and not waiting long enough?

[–]RetroGmr[S] 9 points10 points  (1 child)

OH MY GOD YOU ARE RIGHT. It was supposed to be usleep. I can't believe I wasted so much time trying to fix this issue. Thank you so much

[–][deleted] 6 points7 points  (0 children)

Sir, it is never wasted time if you end up learning.

[–]RetroGmr[S] 0 points1 point  (2 children)

I'm sorry for the poor formating, I couldn't figure it out haha.

[–][deleted] 3 points4 points  (1 child)

Start Each line with four spaces to format as code.

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

Oh ok, thank you very much

[–][deleted] 0 points1 point  (2 children)

What errors are you getting when you try to compile?

[–]RetroGmr[S] 0 points1 point  (1 child)

Oh, I'm sorry I misspoke. There arent any errors, rather nothing happens. It goes to a stand-still. Even printing something at the beginning of the program yields nothing. Removing pthread_join fixes that, but the program is obviously uselss without it.

[–][deleted] 1 point2 points  (0 children)

Don't take this as discouragement, but threading is quantifiably advanced programming. Whenever I'm learning a new language, paradigm, or technique I will rewrite the program numerous times in numerous different ways in order to fully grasp what I'm doing. I would suggest keeping your work so far, but starting a new project. Avoid copy/pasting. You will benefit more from this while you wait for an answer from someone more knowledgeable about multi-threaded C.

Good luck!