mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
CoreMIDI's notification of a removed object moves one atomic count on, and touches no instance; each instance's read and write look for its endpoint again only when the count has moved, on the thread that calls them, so a read or write lists no devices while none has gone. The instance registry and its lock go, and with them the cap of eight instances. The receive callback's shutdown flag is an atomic. samples/midi/coremidi_driver builds the driver against a stand-in for CoreMIDI: reads and writes list no devices until one is removed, a removed input drops the notes queued from it, every instance finds a removal, and removals notified from another thread run beside reads.
41 lines
1.0 KiB
Makefile
41 lines
1.0 KiB
Makefile
# midi/drivers/coremidi.c over a stand-in for CoreMIDI (stub/), so the
|
|
# macOS driver's device removal handling builds and runs anywhere.
|
|
# Includes the driver.
|
|
|
|
include ../../sample_objdir.mk
|
|
|
|
TARGET := coremidi_driver_test
|
|
CORE_DIR := ../../..
|
|
LRC := $(CORE_DIR)/libretro-common
|
|
|
|
SOURCES := coremidi_driver_test.c \
|
|
$(LRC)/rthreads/rthreads.c
|
|
CFLAGS += -Wall -std=gnu99 -g1 -O1 -D_GNU_SOURCE -DHAVE_THREADS \
|
|
-Istub -I$(CORE_DIR) -I$(CORE_DIR)/midi -I$(LRC)/include
|
|
LDFLAGS += -lpthread -lm
|
|
OBJS := $(call sample_objs,$(SOURCES:.c=.o))
|
|
|
|
ifneq ($(SANITIZER),)
|
|
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
|
endif
|
|
|
|
all: $(TARGET)
|
|
%.o: %.c
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
$(SAMPLE_OBJDIR)/%.o: $$(call sample_src,$$*).c
|
|
@mkdir -p $(@D)
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
$(TARGET): $(OBJS)
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
|
|
|
check: $(TARGET)
|
|
./$(TARGET)
|
|
|
|
clean:
|
|
rm -rf $(SAMPLE_OBJDIR)
|
|
rm -f $(TARGET) $(TARGET).exe coremidi_driver_test.o
|
|
|
|
.PHONY: all check clean
|