Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 6f2e6bc

Browse files
committed
extern(D) for swapContext
1 parent 7b6be51 commit 6f2e6bc

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/core/thread/osthread.d

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,23 +123,20 @@ version (Solaris)
123123
*/
124124
private extern(C) void* _d_eh_swapContext(void* newContext) nothrow @nogc;
125125

126-
private mixin template swapContextDefault()
127-
{
128-
extern(C) void* swapContext(void* newContext) nothrow @nogc
129-
{
130-
return _d_eh_swapContext(newContext);
131-
}
132-
}
133-
134126
version (DigitalMars)
135127
{
136128
version (Windows)
137-
mixin swapContextDefault;
129+
{
130+
extern(D) void* swapContext(void* newContext) nothrow @nogc
131+
{
132+
return _d_eh_swapContext(newContext);
133+
}
134+
}
138135
else
139136
{
140137
extern(C) void* _d_eh_swapContextDwarf(void* newContext) nothrow @nogc;
141138

142-
extern(C) void* swapContext(void* newContext) nothrow @nogc
139+
extern(D) void* swapContext(void* newContext) nothrow @nogc
143140
{
144141
/* Detect at runtime which scheme is being used.
145142
* Eventually, determine it statically.
@@ -173,7 +170,12 @@ version (DigitalMars)
173170
}
174171
}
175172
else
176-
mixin swapContextDefault;
173+
{
174+
extern(D) void* swapContext(void* newContext) nothrow @nogc
175+
{
176+
return _d_eh_swapContext(newContext);
177+
}
178+
}
177179

178180
///////////////////////////////////////////////////////////////////////////////
179181
// Thread

src/core/thread/threadbase.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private
8282
enum mutexAlign = classInstanceAlignment!Mutex;
8383
enum mutexClassInstanceSize = __traits(classInstanceSize, Mutex);
8484

85-
extern(C) void* swapContext(void* newContext) nothrow @nogc;
85+
alias swapContext = externDFunc!("core.thread.osthread.swapContext", void* function(void*) nothrow @nogc);
8686

8787
alias getStackBottom = externDFunc!("core.thread.osthread.getStackBottom", void* function() nothrow @nogc);
8888
alias getStackTop = externDFunc!("core.thread.osthread.getStackTop", void* function() nothrow @nogc);

0 commit comments

Comments
 (0)