471,075 Members | 762 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,075 software developers and data experts.

Multithreading Problem

Hi,

I am trying to create a multithreaded VB 2005 application which attempts to
create a new thread per Domain Controller (DC) in my environment. Each thread
connects to its allocated DC and enumerates all computer objects and extracts
the 'LastLogon' property. The results from each thread is then consolidated
so that I can get the true lastlogon date for each computer object.

However in my routine thats get actioned per thread, I have used the
following line which seems to halt each thread and doesn't progress to the
next line of code:
Dim searcher As New DirectorySearcher("LDAP://" + dc.Domain.ToString & "/" &
dc.Name)

Where dc is defined as ActiveDirectory.DomainController.

This is my method of connecting directly to a specific domain controller.
Why would this process halt when it works fine if I do not use
multithreading? Is there a better way of connecting directly to a domain
controller that would get around this problem?

Thanks,
Michael.
May 1 '06 #1
4 1425
According to the DirectorySearcher class information in the help files:

Any public static (Shared in Visual Basic) members of this type are thread
safe. Any instance members are not guaranteed to be thread safe.

HTH

Dave

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
Hi,

I am trying to create a multithreaded VB 2005 application which attempts
to
create a new thread per Domain Controller (DC) in my environment. Each
thread
connects to its allocated DC and enumerates all computer objects and
extracts
the 'LastLogon' property. The results from each thread is then
consolidated
so that I can get the true lastlogon date for each computer object.

However in my routine thats get actioned per thread, I have used the
following line which seems to halt each thread and doesn't progress to the
next line of code:
Dim searcher As New DirectorySearcher("LDAP://" + dc.Domain.ToString & "/"
&
dc.Name)

Where dc is defined as ActiveDirectory.DomainController.

This is my method of connecting directly to a specific domain controller.
Why would this process halt when it works fine if I do not use
multithreading? Is there a better way of connecting directly to a domain
controller that would get around this problem?

Thanks,
Michael.

May 1 '06 #2
On Sun, 30 Apr 2006 23:52:01 -0700, Michael
<Mi*****@discussions.microsoft.com> wrote:
Hi,

I am trying to create a multithreaded VB 2005 application which attempts to
create a new thread per Domain Controller (DC) in my environment. Each thread
connects to its allocated DC and enumerates all computer objects and extracts
the 'LastLogon' property. The results from each thread is then consolidated
so that I can get the true lastlogon date for each computer object.

However in my routine thats get actioned per thread, I have used the
following line which seems to halt each thread and doesn't progress to the
next line of code:
Dim searcher As New DirectorySearcher("LDAP://" + dc.Domain.ToString & "/" &
dc.Name)

Where dc is defined as ActiveDirectory.DomainController.

This is my method of connecting directly to a specific domain controller.
Why would this process halt when it works fine if I do not use
multithreading? Is there a better way of connecting directly to a domain
controller that would get around this problem?

Thanks,
Michael.


Could this method call be failing whilst multithreading and generating
an exception? As once moved to another thread this can cause the thread
to silently die.
May 1 '06 #3
Thanks David.

So I can only assume that the declaration that I am using, is using an
instance member which is causing me thread problems. Is there any way around
this because this leads me to believe that you cannot program with the
DirectorySearcher object in a multithreaded application.

"David Lee Conley" wrote:
According to the DirectorySearcher class information in the help files:

Any public static (Shared in Visual Basic) members of this type are thread
safe. Any instance members are not guaranteed to be thread safe.

HTH

Dave

"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
Hi,

I am trying to create a multithreaded VB 2005 application which attempts
to
create a new thread per Domain Controller (DC) in my environment. Each
thread
connects to its allocated DC and enumerates all computer objects and
extracts
the 'LastLogon' property. The results from each thread is then
consolidated
so that I can get the true lastlogon date for each computer object.

However in my routine thats get actioned per thread, I have used the
following line which seems to halt each thread and doesn't progress to the
next line of code:
Dim searcher As New DirectorySearcher("LDAP://" + dc.Domain.ToString & "/"
&
dc.Name)

Where dc is defined as ActiveDirectory.DomainController.

This is my method of connecting directly to a specific domain controller.
Why would this process halt when it works fine if I do not use
multithreading? Is there a better way of connecting directly to a domain
controller that would get around this problem?

Thanks,
Michael.


May 1 '06 #4
This is my first real venture into multithreading. I have tried placing
Try...Catch blocks around the 'DirectorySearcher' declaration and also placed
debug.print statements either side. No exceptions are being reported and the
post debug.print statement also doesn't get executed.

If each thread is dieing is there a way to report this back to the main
application thread?

"Chris Chilvers" wrote:
On Sun, 30 Apr 2006 23:52:01 -0700, Michael
<Mi*****@discussions.microsoft.com> wrote:
Hi,

I am trying to create a multithreaded VB 2005 application which attempts to
create a new thread per Domain Controller (DC) in my environment. Each thread
connects to its allocated DC and enumerates all computer objects and extracts
the 'LastLogon' property. The results from each thread is then consolidated
so that I can get the true lastlogon date for each computer object.

However in my routine thats get actioned per thread, I have used the
following line which seems to halt each thread and doesn't progress to the
next line of code:
Dim searcher As New DirectorySearcher("LDAP://" + dc.Domain.ToString & "/" &
dc.Name)

Where dc is defined as ActiveDirectory.DomainController.

This is my method of connecting directly to a specific domain controller.
Why would this process halt when it works fine if I do not use
multithreading? Is there a better way of connecting directly to a domain
controller that would get around this problem?

Thanks,
Michael.


Could this method call be failing whilst multithreading and generating
an exception? As once moved to another thread this can cause the thread
to silently die.

May 2 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Robert Zurer | last post: by
6 posts views Thread by Michael C | last post: by
5 posts views Thread by sarge | last post: by
2 posts views Thread by Multithreading problem in vb.net | last post: by
reply views Thread by denis.cornehl | last post: by
2 posts views Thread by Pradnya Patil | last post: by
7 posts views Thread by Ray | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.