.NET "Timer" would block other method calls?

Posted by Ricky on Stack Overflow See other posts from Stack Overflow or by Ricky
Published on 2010-06-15T10:20:33Z Indexed on 2010/06/15 10:22 UTC
Read the original article Hit count: 193

Filed under:
|

Hi guys:

In ASP.NET 3.5, we suspect a delegate triggering by a "Timer" will block other method calls. From logs, some function calls will wait for the finishing of the delegate and continue to work.

Is it true? If yes, what workaround can I do?

PS: The delegate contains codes to use WCF to retrieve data and the following code

    private void Replace<T>(ref IList<T> src, IList<T> des)
    {
        lock(src)
        {
            while (src.Count > 0)
            {
                GC.SuppressFinalize(src.ElementAt(0));
                src.RemoveAt(0);
            }
            GC.SuppressFinalize(src);
            src = des;
        }
    }

Thanks a lot.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about ASP.NET