Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Single Threading a Web Service

28 views
Skip to first unread message

Gregory_May

unread,
Apr 19, 2006, 5:46:43 PM4/19/06
to
I am writing a web service to talk to a single threaded Com Componant. Is
there a simple way to single thread my Web Service so the Com Object doesnt
get confused?

Below is a stab:

<WebMethod()> _
Public Function MyWebService(ByVal MyParm As string)
Static Dim SyncObject As New Object
SyncLock (SyncObject)

SillySingleThreadedCOMObject.Method(MyParm)

End SyncLock

End Function


Josh Twist

unread,
Apr 20, 2006, 3:13:59 AM4/20/06
to
That should work within an appdomain. If you want to synchronise access
to the COM object across the whole machine you'll need to use a mutex.

Why is the COM single threaded - is it a VB6 component running in an
STA? If so, you can usually just add the component to COM+ and you'll
get access to a lot more threads from the COM+ STA threadpool.

Josh
http://www.thejoyofcode.com/

Gregory_May

unread,
Apr 20, 2006, 11:49:38 AM4/20/06
to
Thanks!

Its a 3rd party dll for talking to a piece of hardware.


"Josh Twist" <josh....@gmail.com> wrote in message
news:1145517239.5...@z34g2000cwc.googlegroups.com...

0 new messages