Auugh!  Seriously, everything doesn't have to be a thread!

Comments

  1. No a thread is not good for everything, sometimes you need two threads!

    ReplyDelete
  2. LOL!

    I hate the "thread optimization"!
    That is SO annoying!

    A

    ReplyDelete
  3. Ondrej Kelle unless you use fibers and IWebBrowser. IE's JavaScript engine does some nasty stack pointer tricks.

    ReplyDelete
  4. I think people should use MORE threads.  It would demystify them, improve the tech used to implement them, and forever get rid of non-responding UX.

    ReplyDelete
  5. inter process signalling is a lot more expensive and complex than inter thread signalling, though - melice huang

    ReplyDelete
  6. Threads start to shine when you thread many of them into a canvas.

    ReplyDelete
  7. type // simplified
      TMyLockableObject = class(TObject, ILockableObject);
      TMyLockableObject = class(TInterfacedObject, ILockableObject);
    var
      v : TMyLockableObject;
    ...
       v.Lock;
      try
        ..code..
        v.prop := data;
      finally
        v.Unlock;
      end;

    You also add the lock/unlock in setters and getters that may be used in contention situations.
    Normally not needed if 
    - the v variable can't change via threading
    - the v.props are of integer size or less (ie atomic)

    ReplyDelete
  8. You are right.  I actually prefer
    TLockableObject = class(TInterfacedPersistent, ILockableObject)

    ReplyDelete
  9. Lars Fosdal bet you like it more cause you can use that in packages :)

    A

    ReplyDelete

Post a Comment