diff options
| author | Russ Cox <rsc@swtch.com> | 2020-01-19 22:39:22 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@swtch.com> | 2020-01-19 23:04:58 -0500 |
| commit | 41b3e8b9893a8561af7e85ca98444bc284b4013d (patch) | |
| tree | e9bf7fdeefbdb7d2e6c1ebc25c7888b81f0bb16b /src/libthread/threadimpl.h | |
| parent | ac8042dfa9819f76ccfedd4aa36c1239322808b8 (diff) | |
libthread: use consistent stack calculation code in makecontext
Also reduce duplication: makecontext is per-arch not per-os-arch.
May fix #353.
Diffstat (limited to 'src/libthread/threadimpl.h')
| -rw-r--r-- | src/libthread/threadimpl.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h index 5b6d74cc..cceb1b8e 100644 --- a/src/libthread/threadimpl.h +++ b/src/libthread/threadimpl.h @@ -188,3 +188,6 @@ extern void _threadpexit(void); extern void _threaddaemonize(void); extern void *_threadstkalloc(int); extern void _threadstkfree(void*, int); + +#define USPALIGN(ucp, align) \ + (void*)((((uintptr)(ucp)->uc_stack.ss_sp+(ucp)->uc_stack.ss_size)-(align))&~((align)-1)) |