Synclock in IIS Hosted Remoting - Single Threading Function Call?

Discussion in 'ASP .Net' started by Spam Catcher, Mar 1, 2007.

  1. Spam Catcher

    Spam Catcher Guest

    Hi all,

    I'm hosting a remoting service in IIS. I have a function which I only want
    one concurrent access at a time. Will this prevent multiple users from
    accessing the function at a paritcular time?

    'Empty object used for sync locking purposes
    Private Shared MySyncLockObject as new Object

    'Only want 1 user to acces function at a time
    Public Sub SingleThreadedSubProcedure
    Synclock MySyncLockObject
    'Code in here...
    End Synclock
    End Sub

    Will Synclock globally restrict access to the sub to a single thread at a
    time?
     
    Spam Catcher, Mar 1, 2007
    #1
    1. Advertising

  2. Spam Catcher

    bruce barker Guest

    in general yes. but the lock is only honored in the current appdomain.
    this means during a recycle, ongoing requests are handled in the old
    appdomain, and new ones in the new appdomain. the lock will cause
    queuing, so several requests could be process in the old domain.

    if this is a problem for you, use an o/s mutex.

    -- bruce (sqlwork.com)

    Spam Catcher wrote:
    > Hi all,
    >
    > I'm hosting a remoting service in IIS. I have a function which I only want
    > one concurrent access at a time. Will this prevent multiple users from
    > accessing the function at a paritcular time?
    >
    > 'Empty object used for sync locking purposes
    > Private Shared MySyncLockObject as new Object
    >
    > 'Only want 1 user to acces function at a time
    > Public Sub SingleThreadedSubProcedure
    > Synclock MySyncLockObject
    > 'Code in here...
    > End Synclock
    > End Sub
    >
    > Will Synclock globally restrict access to the sub to a single thread at a
    > time?
     
    bruce barker, Mar 1, 2007
    #2
    1. Advertising

  3. Spam Catcher

    Spam Catcher Guest

    bruce barker <> wrote in news:O88yRCDXHHA.3332
    @TK2MSFTNGP04.phx.gbl:

    > in general yes. but the lock is only honored in the current appdomain.
    > this means during a recycle, ongoing requests are handled in the old
    > appdomain, and new ones in the new appdomain. the lock will cause
    > queuing, so several requests could be process in the old domain.
    >
    > if this is a problem for you, use an o/s mutex.
    >


    I switched my code over to a mutex - which should work out great.

    Thanks for the info :)
     
    Spam Catcher, Mar 7, 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. Lucas Tam
    Replies:
    3
    Views:
    2,050
    Reza Alirezaei
    Aug 9, 2005
  2. Rory Becker
    Replies:
    5
    Views:
    448
    Steven Cheng [MSFT]
    Jun 11, 2008
  3. Smith
    Replies:
    2
    Views:
    539
    Smith
    Apr 27, 2009
  4. Bill Zickmantel

    Random 401 errors using .NET Remoting hosted in IIS

    Bill Zickmantel, Nov 15, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    254
    Bill Zickmantel
    Nov 15, 2004
  5. Peter Stojkovic
    Replies:
    0
    Views:
    494
    Peter Stojkovic
    Mar 30, 2006
Loading...

Share This Page