Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
I assume that you are using a RTOS?. These usually have built in communication between tasks. Of couse you can always use public bit variables to flag between tasks. Can you be more specific on what you are trying to do.
reply no1 is good, you could have binary semaphore (mutex between 2 threads) or a counting semaphore with atomic WAIT(S) and SIGNAL(S). Depending on what you init the S with you can have that many threads accessing the critical section. WAIT(S) decrements S (and lets x threads through, x=current S) and SIGNAL(s) increments.
However reply2 is also good. there are generic wait(S) and signal(S) depending on what you use for coding.
I think the answer depends on the platform that you will use for the semaphor.
If it is an embebed system, you must think in an RTOS, depending on the micro that you will use, you can find many RTOS framworks (ex. Slavo for PIC, ...)
If you whan to use a PC or something simillar (a PC/104, a Java enabled processor, ...) you can use Languages such Java that disponibilize threads that can be sincronized, and you can use the system timer events.