Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
semaphores
#1
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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
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.
My code examples are always for Python >=3.6.0
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  talk about semaphores elizabethreeder 0 1,090 Apr-17-2018, 09:35 AM
Last Post: elizabethreeder

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020