In a particular system there are two threads T1 and T2.
T1 is the master thread that periodically sends messages to the worker thread T2.
The system is time-critical and hence T2 must react to every message that T1 sends.
None of the messages must be lost.T2 performs time consuming operations like
mixing sound samples and sending them to the sound buffer.

Here is the hypothetical POSIX like library that is available to
synchronize the threads:

Mutex locking and unlocking are done through to the calls
int lock(Mutex_t* mutex);
int unlock(Mutex_t* mutex);

Thread messaging is done through condition variables that operate
with an associated mutex.

A thread that responds to a message needs to wait on a condition variable.
It should own the associated mutex prior to entering the wait state.
When it enters the wait state, it simultaneously releases the ownership
of the mutex. Upon return from the wait state, it owns the mutex.
int wait(Condition_t* condition, Mutex_t* mutex);

A thread that sends message to another thread needs to signal the condition
variable. In order to signal the condition variable, the thread must own the
associated mutex.If no thread is waiting on the condition variable, the `signal'
or message is lost. If a thread is waiting on the condition variable, then it resumes
execution.
int signal(Condition_t* condition, Mutex_t* mutex);

Hw can i write c# code for the this

In a particular system there are two threads T1 and T2.
T1 is the master thread that periodically sends messages to the worker thread T2.
The system is time-critical and hence T2 must react to every message that T1 sends.
None of the messages must be lost.T2 performs time consuming operations like
mixing sound samples and sending them to the sound buffer.

Here is the hypothetical POSIX like library that is available to
synchronize the threads:

Mutex locking and unlocking are done through to the calls
int lock(Mutex_t* mutex);
int unlock(Mutex_t* mutex);

Thread messaging is done through condition variables that operate
with an associated mutex.

A thread that responds to a message needs to wait on a condition variable.
It should own the associated mutex prior to entering the wait state.
When it enters the wait state, it simultaneously releases the ownership
of the mutex. Upon return from the wait state, it owns the mutex.
int wait(Condition_t* condition, Mutex_t* mutex);

A thread that sends message to another thread needs to signal the condition
variable. In order to signal the condition variable, the thread must own the
associated mutex.If no thread is waiting on the condition variable, the `signal'
or message is lost. If a thread is waiting on the condition variable, then it resumes
execution.
int signal(Condition_t* condition, Mutex_t* mutex);

Hw can i write c# code for the this

Hai i am akrthik. New To this Site.Help me to add two numbers in C# and the O/p must be

Sum of 5 and 4 is 9
:rolleyes:

This article has been dead for over six months. Start a new discussion instead.