[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

2.5 second "pause" between when code exits and command line comes back (ThreadExit)

Asked by BillBach in C Programming Language, Windows Programming

Tags: C

I have a Win32 command line application that uses ODBC calls to access any database.  Everything seems to be working great, except for a minor performance issue that we are now battling.  At the end of the code, as the application is termination, we are seeing a "pause" that can run as long as 2.5 seconds (or more).  

This is not in my code, but rather is AFTER my code exits.  The end of the application looks like this:
      if(DisplayTimes)
            PrintTime("Tearing Down SQL Environment");
      TearDownSQLEnvironment();
      if(DisplayTimes)
            PrintTime("Complete!");
      exit(ReturnStatus);
}

When run, I get a list of timestamps including the following:

18:29:43.650: Finished Data Read
18:29:43.650: Free Statement Handle
18:29:43.650: Disconnect from Database
18:29:43.728: Tearing Down SQL Environment
18:29:43.728: Complete!

As you can see, the call to disconnect from the database takes some time, but tearing down the environment takes almost no time at all.  The problem, though, is that the program is exiting, but control is not returned to the command line for some time thereafter.  The code snippet shows a Process Monitor trace that shows that the Thread Exit call is occurring at 18:29:43.719 (actually a bit BEFORE the program actually finishes, but this could be a timer issue).  In any event, nothing happens for the next 2.5 seconds and we sit there waiting for the command prompt to come back.  Even checking through the intervening calls with ProcMon, I don't see anything other than the typical "idle chatter" of AV and other agents.  (No, AV is not the issue, as I can duplicate the problem on other systems with no AV code.)

The application I am using is called SQLExec, and is also available for download from www.goldstarsoftware.com/tools.asp.  You can test it yourself to any ODBC database by issuing a command like this:
    SQLEXEC <DSNName> "SELECT TOP 1 * FROM TableName" /DT

The app is fast, but the delay FOLLOWING the app is positively maddening!  Help!

I've surmised that this is unloading of DLL's related to ODBC and the database, but I have not found a way to confirm this as of yet.  
1:
2:
3:
4:
5:
6:
7:
8:
17145	18:29:43.7198046	sqlexec.exe	4640	Thread Exit		SUCCESS	User Time: 0.0000000, Kernel Time: 0.0000000
19361	18:29:46.2529335	sqlexec.exe	4640	RegOpenKey	HKLM\Software\Microsoft\Windows NT\CurrentVersion\GRE_Initialize	SUCCESS	Desired Access: Read
19362	18:29:46.2529836	sqlexec.exe	4640	RegQueryValue	HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize\DisableMetaFiles	NAME NOT FOUND	Length: 20
19363	18:29:46.2530469	sqlexec.exe	4640	RegCloseKey	HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize	SUCCESS	
19365	18:29:46.2531342	sqlexec.exe	4640	Thread Exit		SUCCESS	User Time: 0.0312500, Kernel Time: 0.2031250
19374	18:29:46.2542871	sqlexec.exe	4640	Process Exit		SUCCESS	Exit Status: 0, User Time: 0.0468750, Kernel Time: 0.1562500
19375	18:29:46.2545963	sqlexec.exe	4640	CloseFile	C:\Develop\Win32\SQLExec\Release	SUCCESS	
19377	18:29:46.2548343	sqlexec.exe	4640	CloseFile	C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03	SUCCESS
[+][-]05/12/08 10:12 AM, ID: 21548734Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: C Programming Language, Windows Programming
Tags: C
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 5
Solution Grade: A
 
[+][-]05/10/08 01:17 AM, ID: 21538206Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/10/08 06:51 AM, ID: 21539043Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/10/08 08:09 AM, ID: 21539303Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/10/08 10:44 AM, ID: 21539911Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/11/08 01:28 AM, ID: 21541830Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/12/08 08:02 AM, ID: 21547556Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/12/08 10:19 AM, ID: 21548803Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/12/08 11:00 AM, ID: 21549146Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/12/08 11:36 AM, ID: 21549432Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/12/08 11:46 AM, ID: 21549503Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/12/08 03:42 PM, ID: 21551071Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/12/08 03:48 PM, ID: 21551108Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/12/08 03:55 PM, ID: 21551133Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/12/08 04:41 PM, ID: 21551320Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/12/08 10:23 PM, ID: 21552502Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/13/08 05:14 AM, ID: 21554205Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/13/08 07:35 AM, ID: 21555438Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05/15/08 04:25 AM, ID: 21572357Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05/15/08 04:28 AM, ID: 21572371Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/15/08 06:42 AM, ID: 21573507Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/15/08 07:08 AM, ID: 21573768Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05/15/08 07:13 AM, ID: 21573816Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/15/08 07:55 AM, ID: 21574305Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/15/08 08:30 AM, ID: 21574734Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/16/08 12:15 PM, ID: 21585571Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/16/08 12:20 PM, ID: 21585622Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/21/08 06:07 AM, ID: 21614574Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 / EE_QW_2_20070628