When more than one domain folder has been initialized, the Win32® WaitForSingleObject function returns when an event is set for any of those domain folders. The sequential processing for the example function EnumerateMachinesInSiteContainer in Sequential Processing of Domain Folders could not be used. While processing each domain folder, your application must be aware of all other domain folders that have been initialized.
When your application processes each domain folder, it triggers the machine folder retrieval for a domain folder by calling SmsGetFolderCount (or another function from the list of domain folder intialization functions) and then calling WaitForSingleObject. However, when WaitForSingleObject returns, your application cannot detect which domain folder set the signaled state on the event. To confirm which domain folder set the signaled state, your application should use the following technique:
For each domain folder, maintain a running count of the machine folders retrieved. When the WaitForSingleObject function returns, call the SmsGetFolderCount function and then compare the current count with the previous count. If there is a change, there are more machine folders in the domain folder that your application can process. If the count is unchanged for that domain folder, then the signal was for another domain folder. You must now call SmsGetFolderCount for each domain folder that has been initialized.
Your application should use this technique to ensure that it does not lose a signal for any of the domain folders.