Thread question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fiefie.niles@gmail.com

    #1

    Thread question

    I am using a thread. Inside the thread there is a sub ThreadMain. I am
    calling the thread from the main program MainForm.
    Inside the thread, if I am calling a sub (say doProcess) from the
    MainForm, does it mean that doProcess is processed inside or outside
    the thread ?

    Code from MainForm:
    Public Class MainForm
    Private Session As ClientSession = Nothing
    Private WorkerThread As Threading.Threa d = Nothing

    Public Sub ConnectMenu_Cli ck
    :
    ' Create a new instance of the ClientSession object and a
    worker
    ' thread that will handle the socket I/O
    Session = New ClientSession
    WorkerThread = New Threading.Threa d(AddressOf
    Session.ThreadM ain)

    Session.ClientF orm = Me

    ' Initialize the worker thread and start its execution
    WorkerThread.Na me = "WorkerThre ad"
    WorkerThread.St art()

    Code from the thread:
    Public Class ClientSession
    Public ClientForm As MainForm = Nothing

    Public Sub ThreadMain()
    :
    ClientForm.doPr ocess(strBuffer ) --->will this be executed inside or
    outside the thread ?????
    :

    Thanks.

Working...