You are correct. A mutex would be the answer if you're web service spans
> This will only work within the same worker process ..
>
> If the webservice instances are all runnig in the same process you
> could even just lock on the type to have synchronized behavior between
> multiple instances.
>
> Generally though webservices are run in a multiple process
> configuration (i.e. multiple worker processes). In this case neither
> of the above solutions will work as both are scoped to the process
> level.
>
> If you are running multiple worker processes on the same machine you
> can use a mutex
>
http://msdn2.microsoft.com/en-us/library/system.threading.mutex(VS.80)
> .aspx to synchronize all (including between processes)
>
> If you are running multiple processes on multiple machines, you would
> need to put up a manager process to manage the synchronization between
> them.
>
> Cheers,
>
> Greg
> "Shaun McDonnell" <shaun.mcdonnell@gmail.com> wrote in message
> news:c33405859f160e8c838dc47cbeea4@msnews.microsoft.com...
>> What you need to do is create a Singleton object and then lock that
>> object. That way even though users's might be calling the webservice
>> at the same time, the object would only allow itself to be called by
>> one thread at a time.
>>
>> Google the "Singleton Pattern."
>>
>> Shaun McDonnell
>>
>>> Noob here,
>>>
>>> I am trying to manage calls from multiple clients to my web service
>>> by only letting one execute at a time and forcing the others to
>>> wait.
>>>
>>> Code is as follows:
>>>
>>> ------------------------------
>>> <WebMethod()> Public Function myFunction(ByVal sXMLData As String)
>>> As
>>> String
>>> Static Dim objLock As New Object
>>> SyncLock objLock
>>>
>>> (do some stuff here)
>>>
>>> Return sRtn
>>>
>>> End Synclock
>>> End Function
>>> --------------------------------
>>> I'm sure there's something I'm missing here, as multiple clients
>>> coming in simultaneously will execute things at the same time. Am I
>>> missing the point of Synclock?
>>> Can someone point me in the right direction?
>>>
>>> TIA
>>>