The component recommends using blocked sockets for threaded applications, so I cant use the recommended code (although it was well described Thanks Trevor). Although I may just have to use non blocking if it proves to difficult and take the resource hit.
Rob Software engineer Wild Software Ltd Ph 03 338-1407 ----- Original Message ----- From: "Nello Sestini" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Tuesday, August 13, 2002 7:54 PM Subject: Re: [DUG]: More thread questions > except if you're required to use blocked socket i/o > you'll be stuck in a socket call and can't call > WaitForAnything() > > if non-blocking socket i/o is an option i agree this > is the way. > > (you may need to use MsgWaitForMultipleObjects() > instead though because it allows notification via > "alert" of completed i/o. > > But the idea is the same > > > -ns > http://www.roserox.co.th > > > ----- Original Message ----- > From: "Trevor Jones" <[EMAIL PROTECTED]> > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > Sent: Tuesday, 13 August 2002 14:20 > Subject: Re: [DUG]: More thread questions > > > > Check out the WaitForMultipleObjects windows API call. It works with an > > array of "Waitable" handles and you can specify a timeout. > > > > If the component you use doesn't provide you with any "Waitable" handles, > > you can easily create one of your own with the CreateEvent API call and > get > > your component to indicate success by calling SetEvent on the same handle. > > > > If you need the ability to provide an abort mechanism before the timeout > has > > been reached, you can create another event and set that in VCL code > without > > having to worry about synchronization issues. > > > > eg: > > > > AbortEvent := CreateEvent(nil,true,false,nil); > > SuccessEvent := CreateEvent(nil,true,false,nil); > > > > procedure TMyForm.btnAbortClick(sender : TObject); > > begin > > SetEvent(AbortEvent); > > end > > > > procedure TMyForm.SMTPComplete(Sender : TObject); > > begin > > SetEvent(SuccessEvent); > > end > > > > procedure TMyThread.Execute; > > var > > WaitHandles : array[0..1] of THandle; > > begin > > WaitHandles[0] := SuccessEvent; > > WaitHandles[1] := AbortEvent; > > ReturnValue := WaitForMultipleObjects(2,@WaitHandles,false,MyTimeout); > > if ReturnValue = WAIT_TIMEOUT then > > // timeout > > else if ReturnValue = WAIT_OBJECT_0 then > > // SuccessEvent Handle was set > > else > > // AbortEvent Handle was set > > end; > > > > > > HTH > > > > Trevor > > > > > > ----- Original Message ----- > > From: "Robert Martin" <[EMAIL PROTECTED]> > > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > > Sent: Tuesday, August 13, 2002 3:46 PM > > Subject: [DUG]: More thread questions > > > > > > > The SMTP component I use to email from within a thread recommends using > > the > > > 'Blocking' transmission method for sending if used from within threads > to > > > reduce resource usage. The downsize is that transmission timeouts are > no > > > longer handled (effectively freezing a particular thread). The > component > > > help suggests writing my own code to handle timeouts but I'm not sure > > > exactly how to do this, ant suggestions would be appreciated? > > > > > > > > > Rob > > > > > > Software engineer > > > Wild Software Ltd > > > Ph 03 338-1407 > > > > > > > > > > -------------------------------------------------------------------------- > > - > > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > > Website: http://www.delphi.org.nz > > > To UnSub, send email to: [EMAIL PROTECTED] > > > with body of "unsubscribe delphi" > > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > > > > > > > > > > > -------------------------------------------------------------------------- > - > > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > > Website: http://www.delphi.org.nz > > To UnSub, send email to: [EMAIL PROTECTED] > > with body of "unsubscribe delphi" > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/