LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Can I use Semaphore bet 2 C programs? (https://www.linuxquestions.org/questions/programming-9/can-i-use-semaphore-bet-2-c-programs-459284/)

Eileen 06-28-2006 07:45 PM

Can I use Semaphore bet 2 C programs?
 
Hello,

I have never use Semaphore before but would like to use it now for my programs. I have two c programs. For example, Test1.c and Test2.c

Can I use semaphore to 'communicate' Test1.c and Test2.c?? Could someone gives me an example? I did the following but the whole os crashes. Do advise me please!

For example, Test2.c:
Semaphore_signal(Testing1);

Test1.c:
Semaphore_t Testing1;
Semaphore_wait(Testing1);

Could someone please tell me what went wrong?

THANK YOU SO MUCH!!!

Tinkster 06-29-2006 02:51 AM

http://www.cs.cf.ac.uk/Dave/C/node26...00000000000000




Cheers,
Tink

Hko 06-29-2006 04:23 AM

Quote:

Originally Posted by Eileen
I have two c programs. For example, Test1.c and Test2.c

Can I use semaphore to 'communicate' Test1.c and Test2.c??

Yes you can. That's what they are invented for.

Quote:

Originally Posted by Eileen
Could someone gives me an example?

See paragraph 5.2 (free downloadable PDF) of the book "Advanced Linux Programming" for an example.


All times are GMT -5. The time now is 05:01 AM.