Click here to Skip to main content
15,923,789 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralSending information to and from different forms Pin
Emile Jacobs8-Jul-03 9:20
Emile Jacobs8-Jul-03 9:20 
GeneralRe: Sending information to and from different forms Pin
dynamic8-Jul-03 9:53
dynamic8-Jul-03 9:53 
GeneralRe: Sending information to and from different forms Pin
Emile Jacobs8-Jul-03 23:45
Emile Jacobs8-Jul-03 23:45 
QuestionHow to make VB ActiveX DLL? Pin
mr20038-Jul-03 9:19
mr20038-Jul-03 9:19 
AnswerRe: How to make VB ActiveX DLL? Pin
Hesham Amin8-Jul-03 20:45
Hesham Amin8-Jul-03 20:45 
GeneralRe: How to make VB ActiveX DLL? Pin
mr20039-Jul-03 2:49
mr20039-Jul-03 2:49 
GeneralRe: How to make VB ActiveX DLL? Pin
Hesham Amin9-Jul-03 3:45
Hesham Amin9-Jul-03 3:45 
QuestionMulti Threading Optimal Use? Pin
rlcc8-Jul-03 4:14
rlcc8-Jul-03 4:14 
I am using multithreading in a program, but since I have never done so before I have some questions as to optimal use. Take the following example:

I have an COM object lets call it "comObj" which has a function "SendData". Since the program operates under heavy volume calling "Senddata" concurrently on seperate threads is desirable.

So now my question, if I call the same function on the same object in multiple threads will I really experience a performance gain? Or do I have to create multiple objects (created inside thread) to see a performace gain?

code:
[code]
'...in some function
Dim comObj as (whatever object)

'these are passed by reference
Dim mySend1 as new OutThread(comObj)
Dim mySend2 as New OutThread(comObj)

'...destroy objects...

Public MustInherit Class ThreadWrap
' i use a threadwrapper because multiple thread subtypes
Protected m_Thread As Thread

Public Sub New()
m_Thread = New Thread(AddressOf run)
End Sub

Public Sub start()
Me.m_Thread.Start()
End Sub

Public MustOverride Sub run()

End Class

Public Class OutThread
Inherits ThreadWrap
dim m_objCom as object

Public Sub New(ByRef comObj As Object)
m_Thread = New Thread(AddressOf run)
m_objCom = comObj
End Sub

Public Overrides Sub run()
'this is the sameobject used in both threads
m_comObj.SendData
End Sub

End Class
[/code]


Now the alternitive I see would be to not delcare your object first and then create and destroy it inside the Run() function, but that would require twice as many calls to the constructor and destructor, plus of course more overall memory.

So logically I would hope the method above does utilize multiple threads, but do all threads have to wait on that one object and does that create a bottle neck? Any clarification would be great thanks.

~rlcc


AnswerRe: Multi Threading Optimal Use? Pin
Daniel Turini8-Jul-03 10:25
Daniel Turini8-Jul-03 10:25 
QuestionHow to Get \ Set The size of one col? Pin
lee12128-Jul-03 3:55
lee12128-Jul-03 3:55 
Questionhow to perform that... Pin
elmahdy7-Jul-03 13:41
elmahdy7-Jul-03 13:41 
AnswerRe: how to perform that... Pin
J. Dunlap7-Jul-03 13:46
J. Dunlap7-Jul-03 13:46 
Generaloutlook style interface Pin
yan194547-Jul-03 8:00
yan194547-Jul-03 8:00 
GeneralRe: outlook style interface Pin
apferreira8-Jul-03 6:04
apferreira8-Jul-03 6:04 
GeneralSystem.IO.DirectoryInfo.GetFiles.Getlength Pin
DxSolo7-Jul-03 6:41
DxSolo7-Jul-03 6:41 
GeneralRe: System.IO.DirectoryInfo.GetFiles.Getlength Pin
Mike Dimmick7-Jul-03 6:53
Mike Dimmick7-Jul-03 6:53 
GeneralWinForms DataGrid - colors and selecting individual cells Pin
IainJ7-Jul-03 3:58
IainJ7-Jul-03 3:58 
GeneralRe: WinForms DataGrid - colors and selecting individual cells Pin
dynamic8-Jul-03 2:03
dynamic8-Jul-03 2:03 
GeneralDeployment problem... Pin
-- NA --6-Jul-03 23:36
-- NA --6-Jul-03 23:36 
GeneralRe: Deployment problem... Pin
-- NA --7-Jul-03 0:34
-- NA --7-Jul-03 0:34 
Generalreading xml files using recordset Pin
r i s h a b h s6-Jul-03 19:05
r i s h a b h s6-Jul-03 19:05 
GeneralRe: reading xml files using recordset Pin
Hesham Amin6-Jul-03 21:45
Hesham Amin6-Jul-03 21:45 
GeneralContextMenu & TextBox Pin
almigrp5-Jul-03 1:24
almigrp5-Jul-03 1:24 
GeneralDeveloping Excel Add-In using VB.NET Pin
AlfredoDS4-Jul-03 2:32
AlfredoDS4-Jul-03 2:32 
GeneralRe: Developing Excel Add-In using VB.NET Pin
apferreira8-Jul-03 6:06
apferreira8-Jul-03 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.