Skip to content

Commit 0e8dbe8

Browse files
wfpokornyc-lipka
authored andcommitted
Adding POV_THREAD_STACK_SIZE macro. (POV-Ray#231)
Unix default is 4MB due regression, otherise 2MB. Checks added for a min size of 64KB.
1 parent 060464b commit 0e8dbe8

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

source/backend/configbackend.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// @parblock
1111
///
1212
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
13-
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
13+
/// Copyright 1991-2017 Persistence of Vision Raytracer Pty. Ltd.
1414
///
1515
/// POV-Ray is free software: you can redistribute it and/or modify
1616
/// it under the terms of the GNU Affero General Public License as
@@ -76,6 +76,20 @@
7676
#define POV_USE_DEFAULT_TASK_CLEANUP 1
7777
#endif
7878

79+
/// @def POV_THREAD_STACK_SIZE
80+
/// Internally defaulted thread stack size which the user can override.
81+
///
82+
/// @note
83+
/// The defaulted minimum is 2MB, but later defaulted to 4MB for unix due user regression.
84+
///
85+
#ifndef POV_THREAD_STACK_SIZE
86+
#define POV_THREAD_STACK_SIZE (1024 * 1024 * 2)
87+
#else
88+
#if POV_THREAD_STACK_SIZE < (1024 * 64)
89+
#error "POV_THREAD_STACK_SIZE set less than 65KB or not a byte count."
90+
#endif
91+
#endif
92+
7993
/// @def POV_CONVERT_TEXT_TO_UCS2
8094
/// Convert text from system-specific format to UCS2.
8195
///

source/backend/support/task.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// @parblock
99
///
1010
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
11-
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
11+
/// Copyright 1991-2017 Persistence of Vision Raytracer Pty. Ltd.
1212
///
1313
/// POV-Ray is free software: you can redistribute it and/or modify
1414
/// it under the terms of the GNU Affero General Public License as
@@ -103,7 +103,7 @@ POV_LONG Task::ConsumedCPUTime() const
103103
void Task::Start(const boost::function0<void>& completion)
104104
{
105105
if((done == false) && (taskThread == NULL))
106-
taskThread = NewBoostThread(boost::bind(&Task::TaskThread, this, completion), 1024 * 1024 * 2); // TODO - make stack size definable
106+
taskThread = NewBoostThread(boost::bind(&Task::TaskThread, this, completion), POV_THREAD_STACK_SIZE);
107107
}
108108

109109
void Task::RequestStop()

unix/povconfig/syspovconfigbackend.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/// @parblock
1212
///
1313
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
14-
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
14+
/// Copyright 1991-2017 Persistence of Vision Raytracer Pty. Ltd.
1515
///
1616
/// POV-Ray is free software: you can redistribute it and/or modify
1717
/// it under the terms of the GNU Affero General Public License as
@@ -50,4 +50,14 @@
5050
#define POV_USE_DEFAULT_TASK_INITIALIZE 1
5151
#define POV_USE_DEFAULT_TASK_CLEANUP 1
5252

53+
// In regression testing an old scene for the 3.7.1 release found
54+
// linux machines needed more stack storage than windows.
55+
#ifndef POV_THREAD_STACK_SIZE
56+
#define POV_THREAD_STACK_SIZE (1024 * 1024 * 4)
57+
#else
58+
#if POV_THREAD_STACK_SIZE < (1024 * 64)
59+
#error "POV_THREAD_STACK_SIZE set less than 65KB or not a byte count."
60+
#endif
61+
#endif
62+
5363
#endif // POVRAY_UNIX_SYSPOVCONFIGBACKEND_H

0 commit comments

Comments
 (0)