added win32 check for number of processors, but cant test.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 19 Feb 2008 22:59:52 +0000 (22:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 19 Feb 2008 22:59:52 +0000 (22:59 +0000)
could somebody running win32 see if headers need to be added to threads.c?

source/blender/blenlib/intern/threads.c
source/blender/src/buttons_scene.c

index d6048b4bade3f98dfc176557c4aa5f61cba94c43..d82d68ff67b9927f3d3f2508b16b8242bc95c53a 100644 (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)
index 7654bc44b755bc004064d9ffa0203fbb19babfd3..4f0e4448b6db06bc0283b28d61b07ad8eafd3798 100644 (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);