mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Proposed method for dealing with stack locals which have non-local lifetime.
This commit is contained in:
parent
15e23312f6
commit
3b5b309b7b
Notes:
git
2020-12-05 07:39:29 +09:00
4 changed files with 76 additions and 51 deletions
16
coroutine/Stack.h
Normal file
16
coroutine/Stack.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* This file is part of the "Coroutine" project and released under the MIT License.
|
||||
*
|
||||
* Created by Samuel Williams on 10/11/2020.
|
||||
* Copyright, 2020, by Samuel Williams.
|
||||
*/
|
||||
|
||||
#include COROUTINE_H
|
||||
|
||||
#ifdef COROUTINE_PRIVATE_STACK
|
||||
#define COROUTINE_STACK_LOCAL(type, name) type *name = ruby_xmalloc(sizeof(type))
|
||||
#define COROUTINE_STACK_FREE(name) ruby_xfree(name)
|
||||
#else
|
||||
#define COROUTINE_STACK_LOCAL(type, name) type name##_local; type * name = &name##_local
|
||||
#define COROUTINE_STACK_FREE(name)
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue