Might sound a stupid question but need to be sure:
When you call ThreadPool.QueueUserWorkItem and
ThreadPool.RegisterWaitForSingleObject passing a New object as state
e.g.: ThreadPool.QueueUserWorkItem(AddressOf MyCallBack, New
MyObject(myArg1, myArg2))
the new object MyObject is instantiated just before QueueUserWorkItem is
called, and not just before MyCallBack is called, isn't it?
It's the same for RegisterWaitForSingleObject, isn't it?
Thanks
Henri 5 6348
Yes, a reference to a brand new MyObject object will be passed into
the method. You also have to create the object before
RegisterWaitForSingleObject.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Mon, 13 Dec 2004 14:34:16 +0100, "Henri" <hm********@hotmail.com>
wrote: Might sound a stupid question but need to be sure:
When you call ThreadPool.QueueUserWorkItem and ThreadPool.RegisterWaitForSingleObject passing a New object as state
e.g.: ThreadPool.QueueUserWorkItem(AddressOf MyCallBack, New MyObject(myArg1, myArg2))
the new object MyObject is instantiated just before QueueUserWorkItem is called, and not just before MyCallBack is called, isn't it? It's the same for RegisterWaitForSingleObject, isn't it?
Thanks
Henri
Thanks,
So the new object will be instantied by the main thread, and MyCallBack will
then be processed by another thread from the threadPool, right?
Henri
"Henri" <hm********@hotmail.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP14.phx.gbl... Might sound a stupid question but need to be sure:
When you call ThreadPool.QueueUserWorkItem and ThreadPool.RegisterWaitForSingleObject passing a New object as state
e.g.: ThreadPool.QueueUserWorkItem(AddressOf MyCallBack, New MyObject(myArg1, myArg2))
the new object MyObject is instantiated just before QueueUserWorkItem is called, and not just before MyCallBack is called, isn't it? It's the same for RegisterWaitForSingleObject, isn't it?
Thanks
Henri
That's correct, Henri.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Mon, 13 Dec 2004 16:41:28 +0100, "Henri" <hm********@hotmail.com>
wrote: Thanks, So the new object will be instantied by the main thread, and MyCallBack will then be processed by another thread from the threadPool, right?
Henri
"Henri" <hm********@hotmail.com> a écrit dans le message de news:%2****************@TK2MSFTNGP14.phx.gbl... Might sound a stupid question but need to be sure:
When you call ThreadPool.QueueUserWorkItem and ThreadPool.RegisterWaitForSingleObject passing a New object as state
e.g.: ThreadPool.QueueUserWorkItem(AddressOf MyCallBack, New MyObject(myArg1, myArg2))
the new object MyObject is instantiated just before QueueUserWorkItem is called, and not just before MyCallBack is called, isn't it? It's the same for RegisterWaitForSingleObject, isn't it?
Thanks
Henri
Thanks for your answers Scott :-) !
"Scott Allen" <bitmask@[nospam].fred.net> a écrit dans le message de
news:gs********************************@4ax.com... That's correct, Henri.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Mon, 13 Dec 2004 16:41:28 +0100, "Henri" <hm********@hotmail.com> wrote:
Thanks, So the new object will be instantied by the main thread, and MyCallBack
willthen be processed by another thread from the threadPool, right?
Henri
"Henri" <hm********@hotmail.com> a écrit dans le message de news:%2****************@TK2MSFTNGP14.phx.gbl... Might sound a stupid question but need to be sure:
When you call ThreadPool.QueueUserWorkItem and ThreadPool.RegisterWaitForSingleObject passing a New object as state
e.g.: ThreadPool.QueueUserWorkItem(AddressOf MyCallBack, New MyObject(myArg1, myArg2))
the new object MyObject is instantiated just before QueueUserWorkItem
is called, and not just before MyCallBack is called, isn't it? It's the same for RegisterWaitForSingleObject, isn't it?
Thanks
Henri
Henri wrote: *Might sound a stupid question but need to be sure:
When you call ThreadPool.QueueUserWorkItem and ThreadPool.RegisterWaitForSingleObject passing a New object as state
e.g.: ThreadPool.QueueUserWorkItem(AddressOf MyCallBack, New MyObject(myArg1, myArg2))
the new object MyObject is instantiated just before QueueUserWorkItem is called, and not just before MyCallBack is called, isn't it? It's the same for RegisterWaitForSingleObject, isn't it?
Thanks
Henri *
-- I tried to use the RegisterWaitForSingleObject function but delhpi
does not recognise the function variables... How did you solve this
problem.
( The WaitForSingleObject function is no problem)
thanks in advance
Douwe
--
Douwe
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sunny |
last post by:
Dear ALL:
I'm writing a program about printer by C# now.I have read Duncan's
article about monitor printer by VB before and followed his method. I use
FindFirstPrinterChangeNotification and...
|
by: SSonnenwald |
last post by:
I have created a piece of code that uses a ThreadPool class and the
QueueUserWorkItem method to add items to the the ThreadPool. What
would seem to be simple I just can not figure out how to tell...
|
by: Max Adams |
last post by:
Threads and ThreadPool's
If I use a ThreadPool how can I tell when a thead in the threadpool has
exited? I don't want to set a global member variable I would much rather be
able to act on an...
|
by: fred |
last post by:
I'm writing an application invoking asynchon methods.
I envision using the .NET thread pool since it matches
well my needs.
There is (at least) 2 methods to do that:
using ThreadPool class...
|
by: Peter Kirk |
last post by:
Hi,
I see in the ThreadPool documentation that the pool has a default limit of
25 threads.
Is it correctly understood that this limit is for my entire application? So
if I have several...
|
by: objectref |
last post by:
hi to all folks,
i want to create the following senario:
i have a T1 (Thread 1) that acts like http server that receives incoming
requests.
From that T1, i want to spawn from T1 to Tn thread...
|
by: pmclinn |
last post by:
In the code format below, is there any way to pass in a variable to the
writefiles proceedure?
ThreadPool.QueueUserWorkItem(AddressOf WriteFiles)
Public Sub WriteFiles(ByVal stateInfo As...
|
by: colinjack |
last post by:
Hi All,
I've been using the original (non-event based) asynchronous design
pattern using delegates. It works fine but performance wise I know
using the ThreadPool is supposed to be far better,...
|
by: robert112 |
last post by:
Question... Can one not use ThreadPool.QueueUserWorkItem with an
anonymous method like so:
ThreadPool.QueueUserWorkItem(delegate
{
//perform IO bound operation.
});
Why did the asp.net team...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |