G
Guest
I have included all the source codes in the attached MyTest.zip
(http://www.codeguru.com/forum/attachment.php?attachmentid=11218)
There are three projects:
VBTestCOM project is a apartment threaded DLL, it has one function doing a
stored procedure call. This DLL will be called from C++ multithread.
C++ test project is a ATL multithreaded DLL, it just simple created
multithread, and call VBTestCom's doSPCall function in each thread.
VB client:
It set thread number and start a loop calling C++ DLL's Do function.
You need created a stored procedure in SQL Server NorthWind database like
this:
create PROCEDURE dbo.usp_Test
AS
BEGIN
insert Categories(CategoryName,[Description])
values( 'CatName', convert(varchar(30),getdate(),9))
WAITFOR delay '00:00:00.100'
end
It create a record in Categories and delay 100 milliseconds.
In C++ debug, Change the thread number and you will see no performance
improvement. Trace time in thread like this:
1 Thread
vb function call time: 109
c++ other code time: 62
2 thread
vb function call time: 156
c++ other code time: 62
3 thread
vb function call time: 256
c++ other code time: 62
It's frustrating! Help!
(http://www.codeguru.com/forum/attachment.php?attachmentid=11218)
There are three projects:
VBTestCOM project is a apartment threaded DLL, it has one function doing a
stored procedure call. This DLL will be called from C++ multithread.
C++ test project is a ATL multithreaded DLL, it just simple created
multithread, and call VBTestCom's doSPCall function in each thread.
VB client:
It set thread number and start a loop calling C++ DLL's Do function.
You need created a stored procedure in SQL Server NorthWind database like
this:
create PROCEDURE dbo.usp_Test
AS
BEGIN
insert Categories(CategoryName,[Description])
values( 'CatName', convert(varchar(30),getdate(),9))
WAITFOR delay '00:00:00.100'
end
It create a record in Categories and delay 100 milliseconds.
In C++ debug, Change the thread number and you will see no performance
improvement. Trace time in thread like this:
1 Thread
vb function call time: 109
c++ other code time: 62
2 thread
vb function call time: 156
c++ other code time: 62
3 thread
vb function call time: 256
c++ other code time: 62
It's frustrating! Help!