Write a class in C# which get an action in its construction

Write a class in C# which get an action (parameter less delegate) in its construction and has a single public method ‘bool execute()’ which does following:

1. Execute the action only if no other thread is currently executing the action.
2. If another thread is already executing, wait until thread finished before returning (but without executing action again)
3. Return true if current thread that action, otherwise false.

Questions by annadm

 

This Question is not yet answered!

 
 

Related Answered Questions

 

Related Open Questions