Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C++ Libraries / April 2005

Tip: Looking for answers? Try searching our database.

SetThreadIdealProcessor Compile Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Josef Gonko - 05 Apr 2005 06:02 GMT
Hello.  I'm running VC++ .NET 2002 SP1 and creating a quick DOSbox program
to calculate FFT's on data sets.  Basically, open data file, load arrays,
compute FFT's on arrays, and write the resultant data to disk.

I have successfully created and am using two threads to simultaneously
compute the FFT's on two processors (dual xeon system).  But, I cannot use
the SetThreadIdealProcessor function on my thread handles.  I get a compile
error of 'SetThreadIdealProcessor undeclared identifier'.  Sometimes
WinXPpro does not schedule the threads properly and they run slowly (as seen
via task manager).

Why is the error occurring because I can see the declaration of the function
in the proper header file?  And, yep, I'm using the correct compiler
settings for multithreading...

Any explanations?  Should I use SetThreadAffinityMask instead?  If so, what
is the format of the mask?
Thanks!
Joe
Severian [MVP] - 05 Apr 2005 06:12 GMT
>Hello.  I'm running VC++ .NET 2002 SP1 and creating a quick DOSbox program
>to calculate FFT's on data sets.  Basically, open data file, load arrays,
[quoted text clipped - 13 lines]
>Any explanations?  Should I use SetThreadAffinityMask instead?  If so, what
>is the format of the mask?

From the docs for SetThreadIdealProcessor():

 "To compile an application that uses this function,
  define the _WIN32_WINNT macro as 0x0400 or later.
  For more information, see Using the SDK Headers."

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real
Josef Gonko - 05 Apr 2005 06:39 GMT
Hello and thank you for the response.

I forgot to mention that.  I did try placing at the very beginning of my
source file, prior to all the .h includes:

#define _WIN32_WINNT >= 0x0501
#define WINVER >= 0x0501

Which are the values for WindowsXP and I learned this from the
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog
/using_the_windows_headers.asp

webpage.

Did I do this incorrectly?

Thanks again,

Joe

>>Hello.  I'm running VC++ .NET 2002 SP1 and creating a quick DOSbox program
>>to calculate FFT's on data sets.  Basically, open data file, load arrays,
[quoted text clipped - 28 lines]
> Microsoft MVP, Windows SDK
> Posting email address is real
Jochen Kalmbach - 05 Apr 2005 07:23 GMT
> Hello and thank you for the response.
>
[quoted text clipped - 3 lines]
> #define _WIN32_WINNT >= 0x0501
> #define WINVER >= 0x0501

Upps...
You must define a *specific* value!

#define _WIN32_WINNT 0x0501
#define WINVER 0x0501

Signature

Greetings
  Jochen

   My blog about Win32 and .NET
   http://blog.kalmbachnet.de/

Josef Gonko - 06 Apr 2005 03:28 GMT
Heya!  Thanks!  Looks like I got it now...  I'm new to multi-threading,
having this new dual xeon system, so thank you for helping me with my
ignorance.

I did have to place the defines between the #include "stdafx.h" and #include
"windows.h"  It didn't work if I placed the defines at the very beginning of
the source file.  Perhaps stdafx.h remodifies my defines before it gets to
windows.h??

Nonetheless, it compiled just great this time around!

Thanks again.  Much appreciated!
Joe

>> Hello and thank you for the response.
>>
[quoted text clipped - 9 lines]
> #define _WIN32_WINNT 0x0501
> #define WINVER 0x0501

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.