added win32 check for number of processors, but cant test.

could somebody running win32 see if headers need to be added to threads.c?
This commit is contained in:
2008-02-19 22:59:52 +00:00
parent 82d769c79f
commit 0c4d1036d6
2 changed files with 12 additions and 4 deletions

View File

@@ -228,7 +228,15 @@ void BLI_unlock_thread(int type)
/* how many threads are native on this system? */
int BLI_system_thread_count( void )
{
int t = (int)sysconf(_SC_NPROCESSORS_ONLN);
int t;
#ifdef WIN32
SYSTEM_INFO info;
GetSystemInfo(&info);
t = (int) info.dwNumberOfProcessors;
#else
t = (int)sysconf(_SC_NPROCESSORS_ONLN);
#endif
if (t>RE_MAX_THREAD)
return RE_MAX_THREAD;
if (t<1)

View File

@@ -2025,11 +2025,11 @@ static void render_panel_output(void)
uiBlockBeginAlign(block);
uiDefIconButBitI(block, TOG, R_THREADS, B_REDR, ICON_AUTO, 10, 63, 20, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Automatic threads from system");
if (G.scene->r.mode & R_THREADS) {
char thread_str[32];
sprintf(thread_str, "Threads: %d", BLI_system_thread_count());
char thread_str[16];
sprintf(thread_str, " Threads: %d", BLI_system_thread_count());
uiDefBut(block, LABEL, 0, thread_str, 30, 63,80,20, 0, 0, 0, 0, 0, "");
} else {
uiDefButS(block, NUM, B_NOP, "Threads:", 35, 63, 80, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render (takes advantage of multi-core and multi-processor computers)");
uiDefButS(block, NUM, B_NOP, "Threads:", 30, 63, 80, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render (takes advantage of multi-core and multi-processor computers)");
}
uiBlockEndAlign(block);