Does CallByName have "problems" with Threads?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phill.  W

    #1

    Does CallByName have "problems" with Threads?

    I have a Console application (which will wind up running on a remote
    host). This has two Threads - the main processor and a second that
    provides a socket-based way of "talking" to the first.

    This is my first foray into multi-threading where threads need to talk to
    one another.

    In the main thread, for one "reason" or another, I have a method
    that internally uses

    Microsoft.Visua lBasic.CallByNa me

    to call methods on a COM object.

    Called from within the "main" thread, this method works perfectly.

    Calling the same method from the second, "remote control" thread,
    the CallByName call itself disappears down a Black Hole somewhere
    - no exception, no timeout; it just hangs the entire process.

    So, what as I doing wrong?

    (paraphrased code - you won't want all 35 classes!)

    Public Class MainServer
    Public ReadOnly Property Wrapper() as COMWrapper
    End Class

    Public Class COMWrapper
    Public Function Request( _
    ByVal saCommandText as String _
    ) as String
    srResult = CallByName( myObject, ...
    End Function
    End Class

    ' ... and the other Thread
    Public Class RemoteControl
    Public Sub New( ByVal oaServer as MainServer )
    m_oServer = oaServer
    End Sub
    Private Sub OnCommandReceiv ed()
    Dim sRC as String _
    = m_oServer.Wrapp er.Request( sRC, "<command>" )
    End Sub
    End Class

    At the moment, I have no attributes or other "decoration " on any
    of the methods or classes (which is probably why I'm having trouble).

    So is there a fundamental problem with CallByName being used
    across Threads, or is it just my rotten code (again)?

    TIA,
    Phill W.


Working...