Click here to Skip to main content
16,016,022 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have started to study thread on c language.
I develop code, Now I want to add threading part with queue which continuously polling if info is coming or not.
Can anyone suggest where do I start ? I'm not asking for the code but just idea or hint !

What I have tried:

I'm very confused where to start.
Posted
Updated 16-Feb-23 21:26pm
Comments
Kenneth Haugland 17-Feb-23 3:06am    
Normally you would just do the checks in a background thread and post the result to the main thread were the UI usually runs. But are you sure you mean C, and not C++ or C#?

Strat by reading up on threading: it's not as simple as it appears.
Here's a few links to get you going: https://dev.to/quantumsheep/basics-of-multithreading-in-c-4pam[^]
Multithreading in C - GeeksforGeeks[^] - those are C language specific and may not work in your specific OS.And they don't touch much on the problems you can get: locking, deadlock, and the planning that needs to go into creating a multithreaded app , particularly in an elderly language like C which probably means a console app (so user input will lock the calling thread completely so it ignores "signals" from the "processing thread" for example).
For that, start here: How to Resolve Multi-Threading Problems in Concurrent C Applications[^] but you will probably need to find other sources as well!
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900