ARCast – Threading and Async IO with Jeff Richter

Play ARCast – Threading and Async IO with Jeff Richter

The Discussion

  • User profile image
    tindbaek

    Hi Jeff (& Ron Smiley),

     

    I found the show very interesting, and I hope you have time for a few questions.

    1) So to call a web service using async I/O I just use one of the Begin methods, and thats it? I dont have to launch a thread or anything?

    2) What do I do for other resources like Files or a COM method call?

    Best regards,
    Niels Tindbæk

  • User profile image
    Jeffrey
    1) That's right. Just call a BeginXxx method. Do not launch your own thread.
    2) The FileStream class offers BeginRead/BeginWrite methods. Use these. For COM methods, you must call them synchronously; or you can spawn a separate thread which calls them synchronously but to the rest of the app it looks like they're being called asynchronously.
  • User profile image
    hellonavneet
    Hi Jeff,

    As per your article on msdn mag every object has a syncBlockIndex that is used when we lock an object during thread sync, from another webcast on msdn about CLR internals I remember you saying that the same syncBlockIndex is used by garbage collector to mark objects as accessible, what happen when an object is locked and garbage collector runs?

    Thanks,
    Navneet

Add Your 2 Cents