Python Forum
semaphores - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: semaphores (/thread-7715.html)



semaphores - Skaperen - Jan-22-2018

i would like to have a pair of cli scripts in Python3, where one of the scripts will be run given a name and it will wait for a semaphore of that name. a 2nd script, if given the same name, will raise that semaphore. some more scripts can be useful: 3: a script to lower the semaphore. 4: a script to show if anything is waiting on the named semaphore, or better yet, how many waiters there are, or even better, list the waiters with process id, time waiting, user name. names should be distinct between users, but maybe it can allow root to raise or lower flags owner by a specified user. can this we done in Python without running a server or daemon process?


RE: semaphores - DeaD_EyE - Jan-22-2018

Semaphores, Locks, Events, Queues, etc. are used in Threads.

You can realize it with a managements process/thread, which starts all other programs in the right order.
Maybe you can do it with named pipes, if you won't have the management process.