Jump to content
Xtreme .Net Talk

ThreadPool.RegisterWaitForSingleObject - what to pass as Object?


Recommended Posts

  • *Experts*
Posted

The function ThreadPool.RegisterWaitForSingleObject takes parameters WaitHandle, WaitOrTimerCallback, Object, Integer, Boolean

 

WaitHandle is the handle to be waited on,

WaitOrTimerCallback is a delegate sub,

Integer is the timeout in millisecond (or -1 for infinite)

Boolean is whether this is only fired once

 

But what goes in Object ?

 

Thanks in advance,

Baffled of Ballsbridge

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • *Experts*
Posted

*Resolved* ThreadPool.RegisterWaitForSingleObject - what to pass as Object?

 

Never mind - it's there so you can pass anything you need to the callback procedure

 

*sigh - so much to learn!*

Printer Monitor for .NET? - see Merrion Computing Ltd for details
  • *Gurus*
Posted
Thank God it's there. Back in VB6 you only got a 32-bit parameter to work with, and had to use it as a pointer if you wanted to pass more than a long integer. Then in the callback you had to allocate memory and set it to the passed pointer. Sure, it wasn't exactly hard to do, but this saves us the trouble.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...