Can a process signal a semaphore that is waited by a diff. process?

Can a process signal a semaphore that is waited by a diff. process?

Post by Yang-Cheng Hsi » Mon, 01 Jan 1996 04:00:00



Hi:

I am wondering if a process can signal a semaphore that
is being waited by a different process?

The reason I hope to do this is that I don't want the
waiting process to do anything until the signaling
process finishes doing certain things.

I tried this. However, my waiting process seems to
wait forever even after the signaling process releases
the waited semaphore.(I did check the Sem ID in
both processes, and they were the same.)

Any advice for me? Please email me. Thanks!

Yang-Cheng

 
 
 

Can a process signal a semaphore that is waited by a diff. process?

Post by Bil Lew » Wed, 03 Jan 1996 04:00:00


Yang-Cheng,

  Yes, it can.  You are most correct in that.  Take a look at the example code
for x-process synchronization in the threads library.  Our book has  a simple example
in it:

See the threads page:
http://www.sun.com/sunsoft/Products/Developer-products/sig/threads/in...
Read the newsgroup:
comp.programming.threads
then buy the book:
"Threads Primer", Prentice Hall, Nov '95, ISBN 0-13-443698-9
http://www.sun.com/cgi-bin/show?smi/ssoftpress/books/Lewis/Lewis.html

-Bil


Quote:> Hi:

> I am wondering if a process can signal a semaphore that
> is being waited by a different process?

> The reason I hope to do this is that I don't want the
> waiting process to do anything until the signaling
> process finishes doing certain things.

> I tried this. However, my waiting process seems to
> wait forever even after the signaling process releases
> the waited semaphore.(I did check the Sem ID in
> both processes, and they were the same.)

> Any advice for me? Please email me. Thanks!

> Yang-Cheng

---

 
 
 

1. a process notice other processes by semaphore

Now,I have known a main process can notice other processes to work through
setting semaphore's count.The other processes are waiting for the semaphore
round.When other processes finished their work,I donot hope them to do
repeatly,while rest until main process notice them again.How should I do?

Regards.

2. Gnome 2.0

3. wait for the child process from other process

4. Using xntpd via dialup link?

5. Child Process Waiting for Parent Process

6. Please Help! INN Errors

7. background process, wait and signal

8. install on small HD

9. Signals from child process can't interrupt wait() from parent?

10. Process wait times, scheduling and signal delivery

11. How do I get the process GROUP ID of the signaling process?

12. Can a signal be sent to process when another process dies or stops?

13. How to Kill Process and Its sub-process and its sub-process??