ObjectHandle.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // System.Runtime.Remoting.ObjectHandle.cs
  3. //
  4. // Authors:
  5. // Dietmar Maurer ([email protected])
  6. // Gonzalo Paniagua ([email protected])
  7. // Jaime Anguiano Olarra ([email protected])
  8. //
  9. // (C) Ximian, Inc. http://www.ximian.com
  10. //
  11. //
  12. using System;
  13. using System.Runtime.Serialization;
  14. using System.Runtime.Remoting.Lifetime;
  15. namespace System.Runtime.Remoting {
  16. public class ObjectHandle : MarshalByRefObject, IObjectHandle {
  17. private object _wrapped;
  18. private object life_ctrl;
  19. public ObjectHandle (object o)
  20. {
  21. _wrapped = o;
  22. }
  23. [MonoTODO]
  24. public override object InitializeLifetimeService ()
  25. {
  26. life_ctrl = base.InitializeLifetimeService ();
  27. ILease ilife_ctrl = life_ctrl as ILease;
  28. if (ilife_ctrl != null)
  29. // I can't see in the .NET docs if the lifetime counter
  30. // must be initialized to the time the object is created
  31. // or if a relativistic time is enough (as both differ in
  32. // fact just in a constant. In the meantime I'll use 0.
  33. ilife_ctrl.InitialLeaseTime = new TimeSpan ((long) 0);
  34. return ilife_ctrl;
  35. }
  36. public object Unwrap ()
  37. {
  38. return _wrapped;
  39. }
  40. }
  41. }