diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-11-10 10:21:14 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-12-05 11:38:56 +1300 |
commit | 3b5b309b7b3724849c27dc1c836b5348a8a82e23 (patch) | |
tree | d950dd6df636d053563d117bbeed169ceed2c1b7 /coroutine | |
parent | 15e23312f6abcbf1afc6fbbf7917a57a0637f680 (diff) | |
download | ruby-3b5b309b7b3724849c27dc1c836b5348a8a82e23.tar.gz |
Proposed method for dealing with stack locals which have non-local lifetime.
Diffstat (limited to 'coroutine')
-rw-r--r-- | coroutine/Stack.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/coroutine/Stack.h b/coroutine/Stack.h new file mode 100644 index 0000000000..f0fc703622 --- /dev/null +++ b/coroutine/Stack.h @@ -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 |