Files
RetroArch/samples/cheevos/badge_cache/Makefile
Codex 9002f880a9 cheevos: replace mutexes with owner-thread handoffs
Keep client APIs and server responses on one owner thread, using the
libretro-common task queue for HTTP delivery. Run delayed badge prefetch
on that owner with bounded traversal per tick. Document the ownership
contract and remove the client mutex, its call sites and native backends.

Replace the badge-cache spinlock with libretro-common MPSC requests,
atomic surface transfers and deferred reader-safe retirement. Keep keys
immutable across loads and reject stale generations without waiting.

Cover concurrent requests, resets, late uploads, shared-default recovery,
queued client responses, cancellation and destruction. Guard against
reintroducing the removed locks and run sanitizer/portability CI lanes.
2026-11-15 03:12:49 +01:00

58 lines
1.7 KiB
Makefile

include ../../sample_objdir.mk
TARGET := badge_cache_test
# Links the real cheevos/cheevos_badge.c; everything it reaches for
# (image task, texture upload, badge directory, download request) is
# stubbed in stubs.c, so the test can complete loads one step at a
# time and see exactly what the cache hands back.
REPO_ROOT := ../../..
LIBRETRO_COMM_DIR := $(REPO_ROOT)/libretro-common
SOURCES := badge_cache_test.c \
stubs.c \
$(REPO_ROOT)/cheevos/cheevos_badge.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/file/file_path.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/time/rtime.c \
$(LIBRETRO_COMM_DIR)/rthreads/rthreads.c \
$(LIBRETRO_COMM_DIR)/rthreads/retro_eventcount.c
OBJECTS := $(call sample_objs,$(SOURCES:.c=.o))
CFLAGS += -Wall -std=gnu99 -g1 -O1 -DHAVE_MENU -DHAVE_CHEEVOS -DHAVE_THREADS -DRARCH_INTERNAL \
-I$(REPO_ROOT) -I$(LIBRETRO_COMM_DIR)/include \
-I$(REPO_ROOT)/deps -I$(REPO_ROOT)/deps/rcheevos/include
LDFLAGS += -lm -lpthread
CFLAGS += $(EXTRA_CFLAGS)
CFLAGS += -include ../no_client_locks.h
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
endif
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) -o $@ $^ $(LDFLAGS)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
$(SAMPLE_OBJDIR)/%.o: $$(call sample_src,$$*).c
@mkdir -p $(@D)
$(CC) -c -o $@ $< $(CFLAGS)
check: $(TARGET)
./$(TARGET)
clean:
rm -rf $(SAMPLE_OBJDIR)
rm -f $(TARGET) $(OBJECTS)
.PHONY: all check clean