summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-06 12:24:25 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-06 12:24:25 +0000
commitc454ee6c9fdce8fb558fee0198aea307157ccb23 (patch)
tree3906397d63bca5265ae026454a6d96b15c869f3c /cont.c
parent302fcb568d817bed348f554f1be28951ad924449 (diff)
* cont.c (fiber_machine_stack_alloc): use MAP_STACK if it's provided.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/cont.c b/cont.c
index db4d93b..e46f52c 100644
--- a/cont.c
+++ b/cont.c
@@ -515,7 +515,14 @@ fiber_entry(void *arg)
fiber_set_stack_location();
rb_fiber_start();
}
+#else /* _WIN32 */
+
+#ifdef MAP_STACK
+#define FIBER_STACK_FLAGS (MAP_PRIVATE | MAP_ANON | MAP_STACK)
#else
+#define FIBER_STACK_FLAGS (MAP_PRIVATE | MAP_ANON)
+#endif
+
static VALUE*
fiber_machine_stack_alloc(size_t size)
{
@@ -536,7 +543,7 @@ fiber_machine_stack_alloc(size_t size)
else {
void *page;
STACK_GROW_DIR_DETECTION;
- ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
+ ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, FIBER_STACK_FLAGS, -1, 0);
if (ptr == MAP_FAILED) {
rb_raise(rb_eFiberError, "can't alloc machine stack to fiber");
}