synchronization or semaphores to be specific
hi there, i'm trying to understand the concept of threads and synchronization by this put together code but it's weirdly printing chefs preparing meals before customers even ordering? can i have help on the code or be given resources how to fix it atleast? this is the output for reference
5 Replies
⌛
This post has been reserved for your question.
Hey @wajd! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
most likely happens because the chef thread grabs the order before its printed
you could try placing the print before adding the order to the queue and check the results
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
what's the suggestion? it should grab then print
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.