internal PartialResultsRetriever(ManualResetEvent eventHandle, LdapPartialResultsProcessor processor) { this.workThreadWaitHandle = eventHandle; this.processor = processor; this.oThread = new Thread(new ThreadStart(this.ThreadRoutine)); this.oThread.IsBackground = true; this.oThread.Start(); }
static LdapConnection() { Hashtable table = new Hashtable(); asyncResultTable = Hashtable.Synchronized(table); waitHandle = new ManualResetEvent(false); partialResultsProcessor = new LdapPartialResultsProcessor(waitHandle); retriever = new PartialResultsRetriever(waitHandle, partialResultsProcessor); }
internal PartialResultsRetriever(ManualResetEvent eventHandle, LdapPartialResultsProcessor processor) { _workThreadWaitHandle = eventHandle; _processor = processor; _oThread = new Thread(new ThreadStart(ThreadRoutine)); _oThread.IsBackground = true; // start the thread _oThread.Start(); }
internal PartialResultsRetriever(ManualResetEvent eventHandle, LdapPartialResultsProcessor processor) { _workThreadWaitHandle = eventHandle; _processor = processor; // Start the thread. var thread = new Thread(new ThreadStart(ThreadRoutine)) { IsBackground = true, Name = ".NET LDAP Results Retriever" }; thread.Start(); }
static LdapConnection() { handleTable = new Hashtable(); // initialize the lock objectLock = new Object(); Hashtable tempAsyncTable = new Hashtable(); s_asyncResultTable = Hashtable.Synchronized(tempAsyncTable); s_waitHandle = new ManualResetEvent(false); s_partialResultsProcessor = new LdapPartialResultsProcessor(s_waitHandle); s_retriever = new PartialResultsRetriever(s_waitHandle, s_partialResultsProcessor); }
public void RetrievingSearchResults() { int num = 0; LdapPartialAsyncResult item = null; AsyncCallback asyncCallback = null; lock (this) { int count = this.resultList.Count; if (count != 0) { do { if (this.currentIndex >= count) { this.currentIndex = 0; } item = (LdapPartialAsyncResult)this.resultList[this.currentIndex]; num++; LdapPartialResultsProcessor ldapPartialResultsProcessor = this; ldapPartialResultsProcessor.currentIndex = ldapPartialResultsProcessor.currentIndex + 1; if (item.resultStatus == ResultsStatus.Done) { continue; } this.GetResultsHelper(item); if (item.resultStatus != ResultsStatus.Done) { if (item.callback != null && item.partialCallback && item.response != null && (item.response.Entries.Count > 0 || item.response.References.Count > 0)) { asyncCallback = item.callback; } } else { item.manualResetEvent.Set(); item.completed = true; if (item.callback != null) { asyncCallback = item.callback; } } if (asyncCallback != null) { asyncCallback(item); } return; }while (num < count); this.workToDo = false; this.workThreadWaitHandle.Reset(); return; } else { this.workThreadWaitHandle.Reset(); this.workToDo = false; return; } } if (asyncCallback != null) { asyncCallback(item); } }
static LdapConnection() { LdapConnection.handleTable = new Hashtable(); LdapConnection.objectLock = new object(); Hashtable hashtables = new Hashtable(); LdapConnection.asyncResultTable = Hashtable.Synchronized(hashtables); LdapConnection.waitHandle = new ManualResetEvent(false); LdapConnection.partialResultsProcessor = new LdapPartialResultsProcessor(LdapConnection.waitHandle); LdapConnection.retriever = new PartialResultsRetriever(LdapConnection.waitHandle, LdapConnection.partialResultsProcessor); }