473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1544
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
16
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
6
by: Michael C | last post by:
Hello Can someone please tell me what I'm doing wrong? I'm writing an application that should be using callbacks to perform asynchronous calls to the Win32 API. Problem is it never reaches my...
5
by: sarge | last post by:
I would like to know how to perform simple multithreading. I had created a simple form to test out if I was multithreading properly, but got buggy results. Sometime the whole thig would lock up...
2
by: shonend | last post by:
**** sorry about the length of the message. If you can't read the whole thing and still willing to help, read the last 2 paragraphs where the main problem is described. The introduction story is...
2
by: Multithreading problem in vb.net | last post by:
Greetings, I am new to multithreading and I am trying to implement it in my app. This application is distributed application which needs to refresh every say 5 secs to show some activities in...
0
by: denis.cornehl | last post by:
Hi, I have an unusual Problem with DB2. It is DB2 Version 7 and Fixpack 13 under Windows. We have written an application server which is accessing db2 via c++ and the cli interface. We used...
2
by: Pradnya Patil | last post by:
hi , I am trying to draw ' html div-tag ' on the screen which will resemble a rectangle through vb.net code. I want it to be drawn faster...so I introduced multithreading using Threadpool. I...
7
by: Ray | last post by:
Hello, Greetings! I'm looking for a solid C++ multithreading book. Can you recommend one? I don't think I've seen a multithreading C++ book that everybody thinks is good (like Effective C++ or...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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 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.