F
fniles
I am using thread (sub ThreadMain in the ClientSession class). I call it
from main application called MainForm.
Inside ThreadMain, I call a subroutine WriteLine from the MainForm.
Will WriteLine run/processed inside or outside the thread ?
Thanks.
Code from main appl:
Public Class MainForm
Private Session As ClientSession = Nothing
' 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.Thread(AddressOf Session.ThreadMain)
' Initialize the client session object with the reference to
' this form, and the socket that was created
Session.ClientForm = Me
' Initialize the worker thread and start its execution
' WorkerThread.ApartmentState = Threading.ApartmentState.STA
WorkerThread.Name = "WorkerThread"
WorkerThread.Start()
Public Sub WriteLine(ByVal Line As String)
:
end sub
Code from inside thread:
Public Class ClientSession
Public ClientForm As MainForm = Nothing
Public Sub ThreadMain()
:
ClientForm.WriteLine(strBuffer)
from main application called MainForm.
Inside ThreadMain, I call a subroutine WriteLine from the MainForm.
Will WriteLine run/processed inside or outside the thread ?
Thanks.
Code from main appl:
Public Class MainForm
Private Session As ClientSession = Nothing
' 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.Thread(AddressOf Session.ThreadMain)
' Initialize the client session object with the reference to
' this form, and the socket that was created
Session.ClientForm = Me
' Initialize the worker thread and start its execution
' WorkerThread.ApartmentState = Threading.ApartmentState.STA
WorkerThread.Name = "WorkerThread"
WorkerThread.Start()
Public Sub WriteLine(ByVal Line As String)
:
end sub
Code from inside thread:
Public Class ClientSession
Public ClientForm As MainForm = Nothing
Public Sub ThreadMain()
:
ClientForm.WriteLine(strBuffer)