Application.Lock()/UnLock() or lock(Application)

Discussion in 'ASP .Net Web Services' started by nano2k, Jul 23, 2007.

  1. nano2k

    nano2k Guest

    Hello

    Is there a difference between:

    1.
    Application.Lock();
    try {
    //...code
    }
    finally {
    Application.UnLock();
    }

    pattern and
    2.
    lock(Application) {
    //...code
    }

    ?

    I read on MSDN (http://support.microsoft.com/default.aspx/kb/271787)
    that there are some situations when the first pattern blocks the
    service.

    Thanks.
     
    nano2k, Jul 23, 2007
    #1
    1. Advertising

  2. Hi:

    The first pattern is only applied to application state in web applications
    while second pattern is a rapid and easily implementation of Monitor (enter()
    and exit()) class valid for many situations.

    Sorry for my english!!!

    Regards

    --
    Colabora con el foro: Si la respuesta te es de utilidad marca la pregunta
    como respondida.
    Luis Ruiz Pavón
    MCP - MCTS
    Blog: http://geeks.ms/blogs/lruiz



    "nano2k" wrote:

    > Hello
    >
    > Is there a difference between:
    >
    > 1.
    > Application.Lock();
    > try {
    > //...code
    > }
    > finally {
    > Application.UnLock();
    > }
    >
    > pattern and
    > 2.
    > lock(Application) {
    > //...code
    > }
    >
    > ?
    >
    > I read on MSDN (http://support.microsoft.com/default.aspx/kb/271787)
    > that there are some situations when the first pattern blocks the
    > service.
    >
    > Thanks.
    >
    >
     
    Luis Ruiz Pavón, Jul 24, 2007
    #2
    1. Advertising

  3. nano2k

    nano2k Guest

    On 24 Iul, 14:28, Luis Ruiz Pavón <> wrote:
    > Hi:
    >
    > The first pattern is only applied to application state in web applications
    > while second pattern is a rapid and easily implementation of Monitor (enter()
    > and exit()) class valid for many situations.
    >
    > Sorry for my english!!!
    >
    > Regards
    >
    > --
    > Colabora con el foro: Si la respuesta te es de utilidad marca la pregunta
    > como respondida.
    > Luis Ruiz Pavón
    > MCP - MCTS
    > Blog:http://geeks.ms/blogs/lruiz
    >
    >
    >
    > "nano2k" wrote:
    > > Hello

    >
    > > Is there a difference between:

    >
    > > 1.
    > > Application.Lock();
    > > try {
    > > //...code
    > > }
    > > finally {
    > > Application.UnLock();
    > > }

    >
    > > pattern and
    > > 2.
    > > lock(Application) {
    > > //...code
    > > }

    >
    > > ?

    >
    > > I read on MSDN (http://support.microsoft.com/default.aspx/kb/271787)
    > > that there are some situations when the first pattern blocks the
    > > service.

    >
    > > Thanks.- Ascunde citatul -

    >
    > - Afi are text în citat -


    Thanks Luis for your response
    What is your recommendation. Should we use pattern 1 or pattern 2?
     
    nano2k, Aug 9, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lidia

    how to lock/unlock an ad account

    Lidia, Jul 8, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    741
    Lidia
    Jul 10, 2008
  2. Vijay Ramane
    Replies:
    2
    Views:
    198
    Vijay Ra
    Dec 30, 2010
  3. Sven
    Replies:
    0
    Views:
    262
  4. Dylan Evans
    Replies:
    0
    Views:
    104
    Dylan Evans
    Apr 11, 2013
  5. Sven
    Replies:
    0
    Views:
    99
Loading...

Share This Page