Skip to content

Commit 1073aca

Browse files
committed
Move sched.d in the platform code for linux.
Rework the import logic to include platform specific import.
1 parent 2bce1a9 commit 1073aca

File tree

16 files changed

+44
-29
lines changed

16 files changed

+44
-29
lines changed

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ all: $(ALL_EXECUTABLES) $(ALL_TOOLS) $(LIBSDRT) $(LIBDMDALLOC) $(PHOBOS)
4242
check: all
4343

4444
clean:
45-
rm -rf obj lib $(ALL_EXECUTABLES) $(ALL_TOOLS)
45+
rm -rf obj lib bin/sdconfig $(ALL_EXECUTABLES) $(ALL_TOOLS)
4646

4747
print-%: ; @echo $*=$($*)
4848

sdlib/sys/posix/sched.d renamed to platform/linux/imports/sched.d

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
module sys.posix.sched;
1+
module sched;
22

33
import sys.posix.types;
44

5-
version(Posix):
65
extern(C):
76

87
int sched_yield();

platform/linux/linux.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PLATFORM_IMPORTS += platform/linux/imports

platform/platform.mak

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Platform import to use for libsdrt
2+
PLATFORM_IMPORTS =
3+
14
# Platform objects to link into libsdrt
25
LIBSDRT_PLATFORM_OBJ =
36

@@ -12,7 +15,9 @@ PLATFORM_C_OBJ =
1215
PLATFORM_ASM_SRC =
1316
PLATFORM_ASM_OBJ =
1417

15-
ifeq ($(PLATFORM),Darwin)
18+
ifeq ($(PLATFORM),Linux)
19+
include platform/linux/linux.mak
20+
else ifeq ($(PLATFORM),Darwin)
1621
include platform/osx/osx.mak
1722
endif
1823

sdlib/d/gc/cpu.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private:
1313
shared uint gCoreCount;
1414

1515
auto computeCoreCount() {
16-
import sys.posix.sched;
16+
import sched;
1717
cpu_set_t set;
1818
sched_getaffinity(0, cpu_set_t.sizeof, &set);
1919
return CPU_COUNT(&set);

sdlib/d/gc/tcache.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ private:
794794
* of glibc thanks to rseqs, but we might want to find
795795
* an alternative on other systems.
796796
*/
797-
import sys.posix.sched;
797+
import sched;
798798
return sched_getcpu();
799799
}
800800

sdlib/d/gc/thread.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,14 @@ public:
190190
uint count;
191191

192192
while (suspendRunningThreads(count++)) {
193-
import sys.posix.sched;
193+
import sched;
194194
sched_yield();
195195
}
196196
}
197197

198198
void restartTheWorld() shared {
199199
while (resumeSuspendedThreads()) {
200-
import sys.posix.sched;
200+
import sched;
201201
sched_yield();
202202
}
203203

sdlib/d/gc/tstate.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ unittest suspend {
272272
mutex.unlock();
273273
scope(exit) mutex.lock();
274274

275-
import sys.posix.sched;
275+
import sched;
276276
sched_yield();
277277
continue;
278278
}

sdlib/d/sync/mutex.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import d.sync.waiter;
44

55
import sdc.intrinsics;
66

7-
import sys.posix.sched;
7+
import sched;
88

99
struct Mutex {
1010
private:

sdlib/d/sync/sharedlock.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ unittest threadStressTest {
628628
assert(ne == 0);
629629
assert(ns >= 0 && ns < MaxShared);
630630

631-
import sys.posix.sched;
631+
import sched;
632632
sched_yield();
633633
ns = numSharedLocks.fetchSub(1);
634634

0 commit comments

Comments
 (0)