473,779 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 DirectorySearch er("LDAP://" + dc.Domain.ToStr ing & "/" &
dc.Name)

Where dc is defined as ActiveDirectory .DomainControll er.

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 1572
According to the DirectorySearch er 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*****@discus sions.microsoft .com> wrote in message
news:9B******** *************** ***********@mic rosoft.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 DirectorySearch er("LDAP://" + dc.Domain.ToStr ing & "/"
&
dc.Name)

Where dc is defined as ActiveDirectory .DomainControll er.

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*****@discus sions.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 DirectorySearch er("LDAP://" + dc.Domain.ToStr ing & "/" &
dc.Name)

Where dc is defined as ActiveDirectory .DomainControll er.

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
DirectorySearch er object in a multithreaded application.

"David Lee Conley" wrote:
According to the DirectorySearch er 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*****@discus sions.microsoft .com> wrote in message
news:9B******** *************** ***********@mic rosoft.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 DirectorySearch er("LDAP://" + dc.Domain.ToStr ing & "/"
&
dc.Name)

Where dc is defined as ActiveDirectory .DomainControll er.

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 'DirectorySearc her' 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*****@discus sions.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 DirectorySearch er("LDAP://" + dc.Domain.ToStr ing & "/" &
dc.Name)

Where dc is defined as ActiveDirectory .DomainControll er.

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
4270
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 threads of a multithreaded program using embedded SQL. Since the threads do not need to share transaction scopes, the sqleAttachToCtx family of APIs do not seem to be necessary. <quote> In the default implementation of threaded applications against...
16
8510
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
2316
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 callback function. Any feedback is appreciated. Also, any references to websites with examples of .NET async multithreading would be appreciated. Thanks in advance. public serverInfo getSession(string servername) {
5
2139
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 when I got two threads going at the same time. What I have is two text boxes (textBox1 and textBox2) and four buttons(cmdStartThread1, cmdStartThread2, cmdStopThread1, cmdStopThread2)
2
3741
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 mentioned to, as much clear as possible, give a picture in what environment the problems rise**** Hello experts! I would appreciate if you can address this problem I have and give a hint what could be wrong.
2
3845
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 the datagrid. I have implemented querying the database in a separate thread and and then showing it in the datagrid in the UI thread. It all works fine and the datagrid gets updated every 5 secs. This happens in the desktop (Main form) of the...
0
1261
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 IBM Visual Age as our compiler, because we had to support OS/2. Now we ported it this year to windows and the microsoft-compiler (V8).
2
2267
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 divided the complete drawing into 3 parts..1st will be done by main thread and other two are done in these procedures - <1LongTimeTask <2LongTimeTask2 I have invoked the threads using below method. **************
7
16314
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 Exceptional C++, for example). Platform-specific (e.g.: Win32, POSIX) is OK, as long as it's good :) Thank you, Ray
0
9632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.