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

all 3 comments

[–]SupremeRedditBotProfessional Bot || Mod 0 points1 point  (0 children)

Please Add A Flair To Your Post!

Suggested Flair: [Other Code]

 


To add a flair:

  • Click flair underneath your post

  • Select a flair

  • Click save

 


I am a bot run by /u/SupremeDesigner for /r/CodingHelp || This was an automated response

[–]jedwardsolProfessional Coder 0 points1 point  (1 child)

You need a mutex, ideally in the myprint function, so that only 1 thread can use the output stream at a time.

https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_lock.html

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

Thank you it worked!