In this tutorial we will introduce you to the concept of Thread Locks in Python, what they are, how they are used, and what problem do they solve for us. Website Link: coderslegacy.c...
Пікірлер: 11
@krzysztof75412 ай бұрын
Very nicely shown thank you
@alanperrydaen98185 ай бұрын
Thank you for this tutorial, which helped me a lot in understanding the locks in multithreaded programs
@denjiuzumaki43092 ай бұрын
great video!!!!
@coderslegacy56612 ай бұрын
Glad you liked it!!
@ReinventedWeb Жыл бұрын
Interesting topic. Nice video.
@surajbhattathiri9 ай бұрын
very helpful
@astalavista57163 ай бұрын
So good. Anyhow I have an issue maybe someone can give me some hint . I have like 5 threads running in parallel. They all send signals via radio which turns on the power of a device for several seconds and finally turns it off . However I need kind of functions that almost let all processes to turn on and of in parallel. Eg Airpump runs every 5 min for 1min while 3 waterpump run 3 times a day for x amount of time and Moisture unit runs all 5min for 1 minute. How can I make sure that signals are not sent at same time but as close as possible according to the on and off signal? So the thread may run but the signaling send out should kind of queque
@coderslegacy56613 ай бұрын
Isn't that the point of locks though? So that even if they are sent at the same time, it will not matter. It will just wait until the resource is free. Even if you time the events close together, anomalies could occur which could cause the events to take longer/less time than usual. So timing events close together isn't a very foolproof solution.
@astalavista57163 ай бұрын
@@coderslegacy5661 thing is my thread may run but the signalaling function with a time sleep which is called in a function within the thread should be locked for the second and after the time sleep is over call the siignaling off of that unit. Meanwhihe in parallel other signals on and off may occur
@astalavista57163 ай бұрын
Just a simple example without syntax have 6 functions currently which are called from diffrent threads each for a power radio frequency Func1) Power on: XXXXXX1, puls: 302 - 303 Time.sleep(60) Power off: XXXXXX1, puls: 302 - 303 Func2) Power on: XXXXXX1, puls: 302 - 303 Time.sleep(180) Power off: XXXXXX1, puls: 302 - 303 … What I want is that the power for each power connector goes on for the amount of time but that the signal is send a second after each other . Same with the off signal at the end . So i always have a lock for on and of and in between the functions should run for the amount of time