Archive for June, 2008

Transform Asynchronous method to Synchronous

Sunday, June 22nd, 2008

In the last day, I have found problem to transform an asynchronous call to synchronous. It is not very big problem but this problem is repeated for a big number of methods and components. I think that a good programmer should avoid the copy/paste of code but write a reusable code, for this I write a class that implement a lock/unlock mechanism.
This class has three methods

  • Lock: Lock the object.
  • Unlock: Unlock the object.
  • Wait: Caller remains to wait the Unlock method is called.

The implementation is based over the ReaderWriterLock class, this class protect an enumeration that describe the status of class

(more…)