R
Roberto Rasto
I have a problem.
I'm using an ocx (Pivo.EmailValidator) that have a method: validate (with
the e-mail for parameter).
I'd like to create several thread to validate several e-mail at the same
time.
I need to create another class because the validate method needs parameters
and I can't find any way to pass parameter in the addressof statement when I
create the Thread.
The problem is that the class description say:
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for
multithreaded operations. Instance members are not guaranteed to be
thread-safe.
What does mean?
Can I use this code or I have some problem because I use instanced object?
Thanks a lot.
Roberto
(Emails is an array of email to validate)
.......
Dim Valid as Validator
For i = 1 To UBound(t)
Valid = New Validator
Valid.Email = Emails(i)
Valid.ValidationLevel = 4
t(i) = New Thread(AddressOf objValid.Validate)
t(i).Start()
Next i
.........
Public Class Validator
Public Email as String
Public EmailIsOK as Integer
Public ValidationLevel as Integer
Public Sub Validate()
EmailIsOK = EMailValidator.Validate(EMail, ValidationLevel)
End Sub
End Class
Sorry, but I can't understand if I can instance several objects of this
class and start a method, or I have join the thread with a shared object of
the class
I'm using an ocx (Pivo.EmailValidator) that have a method: validate (with
the e-mail for parameter).
I'd like to create several thread to validate several e-mail at the same
time.
I need to create another class because the validate method needs parameters
and I can't find any way to pass parameter in the addressof statement when I
create the Thread.
The problem is that the class description say:
Thread Safety
Public static (Shared in Visual Basic) members of this type are safe for
multithreaded operations. Instance members are not guaranteed to be
thread-safe.
What does mean?
Can I use this code or I have some problem because I use instanced object?
Thanks a lot.
Roberto
(Emails is an array of email to validate)
.......
Dim Valid as Validator
For i = 1 To UBound(t)
Valid = New Validator
Valid.Email = Emails(i)
Valid.ValidationLevel = 4
t(i) = New Thread(AddressOf objValid.Validate)
t(i).Start()
Next i
.........
Public Class Validator
Public Email as String
Public EmailIsOK as Integer
Public ValidationLevel as Integer
Public Sub Validate()
EmailIsOK = EMailValidator.Validate(EMail, ValidationLevel)
End Sub
End Class
Sorry, but I can't understand if I can instance several objects of this
class and start a method, or I have join the thread with a shared object of
the class