Skip to content

Commit

Permalink
bump sdk, add gthread.native_id
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Jan 4, 2024
1 parent 79cd86c commit b08df42
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
17 changes: 17 additions & 0 deletions packages.d/pygame/pygame.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ then
#unsure
wget -O- https://patch-diff.githubusercontent.com/raw/pmp-p/pygame-ce-wasm/pull/3.diff | patch -p1

patch -p1 << END
diff --git a/buildconfig/Setup.Emscripten.SDL2.in b/buildconfig/Setup.Emscripten.SDL2.in
index 0bd60a30..e74effe9 100644
--- a/buildconfig/Setup.Emscripten.SDL2.in
+++ b/buildconfig/Setup.Emscripten.SDL2.in
@@ -6,7 +6,8 @@
#MIXER = -lSDL2_mixer
#SCRAP =
#FREETYPE = -lfreetype -lharfbuzz
-
+PNG= -lpng
+JPEG= -ljpeg
DEBUG =
# these can build alone and object files merged with ar
END

patch -p1 << END
diff --git a/src_c/static.c b/src_c/static.c
index 03cc7c61..a00a51a7 100644
Expand Down
6 changes: 3 additions & 3 deletions pygbag/support/cross/aio/gthread.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, *, da
self.name = name
self.slice = 0
self.last = aio.rtclock()

self.native_id = id(self)
if target:
if hasattr(target, "run"):
if name is None:
Expand All @@ -112,14 +112,14 @@ def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, *, da

if name is None:
try:
self.name = "%s-%s" % (self.run.__name__, id(self))
self.name = "%s-%s" % (self.run.__name__, self.native_id)
except:
pass
else:
target = self

if self.name is None:
self.name = "%s-%s" % (self.__class__.__name__, id(self))
self.name = "%s-%s" % (self.__class__.__name__, self.native_id)
self.status = None

async def wrap(self):
Expand Down
3 changes: 2 additions & 1 deletion scripts/build-loader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ then
" 1>&2

# -std=gnu99 -std=c++23
# EXTRA_EXPORTED_RUNTIME_METHODS => EXPORTED_RUNTIME_METHODS after 3.1.52

cat > final_link.sh <<END
#!/bin/bash
Expand All @@ -263,7 +264,7 @@ emcc \\
$LOPTS \\
-D__PYDK__=1 -DNDEBUG \\
-sTOTAL_MEMORY=256MB -sSTACK_SIZE=4MB -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH \\
-sEXTRA_EXPORTED_RUNTIME_METHODS=FS \\
-sEXPORTED_RUNTIME_METHODS=FS \\
$CF_SDL \\
--use-preload-plugins \\
$STDLIBFS \\
Expand Down
2 changes: 1 addition & 1 deletion scripts/vendoring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export VENDOR=${VENDOR:-pygbag}
export PACKAGES=${PACKAGES:-emsdk hpy pygame}

export SDKROOT=${SDKROOT:-/opt/python-wasm-sdk}
export SDK_VERSION=${SDK_VERSION:-3.1.51.1bi}
export SDK_VERSION=${SDK_VERSION:-3.1.52.0bi}
export CYTHON=${CYTHON:-Cython-3.0.1-py2.py3-none-any.whl}
export PYBUILD=${PYBUILD:-3.11}
export LC_ALL=C
Expand Down
10 changes: 7 additions & 3 deletions test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,17 @@ async def main():
# Green threads are ordered at runtime unlike system threads.

# erase and fill
Thread(target=color_background, args=[win]).start()
t1=Thread(target=color_background, args=[win])
t1.start()

# 1st object to draw
Thread(target=moving_png, args=[win]).start()
t2=Thread(target=moving_png, args=[win])
t2.start()

# 2nd
Thread(target=moving_bmp, args=[win]).start()
(t3:=Thread(target=moving_bmp, args=[win])).start()

print( t1.native_id , t2.native_id , t3.native_id)

while True:
if count >= 0:
Expand Down

0 comments on commit b08df42

Please sign in to comment.