Synclock in IIS Hosted Remoting - Single Threading Function Call?

G

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?
 
B

bruce barker

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)
 
G

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.

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

Thanks for the info :)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top