Skip to content

Commit

Permalink
Provide ioEventThreadAffinity defines for macOS & other platforms.
Browse files Browse the repository at this point in the history
Fix macos 64-bit Makefiles for threading regime.
  • Loading branch information
eliotmiranda committed Apr 20, 2024
1 parent 5473cde commit a187764
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
9 changes: 6 additions & 3 deletions building/macos64ARMv8/common/Makefile.app
Expand Up @@ -26,6 +26,12 @@
ifeq ($(APPNAME),)
APPNAME:=Cocoa
endif
ifeq ($(THREADING),multi)
ifeq ($(APPNAMEDEF),$(APPNAME))
APPNAMEDEF:=$(APPNAMEDEF)MT
endif
APPNAME:=$(APPNAME)MT
endif
ifeq ($(APPNAMEDEF),)
APPNAMEDEF:=$(APPNAME)Fast
endif
Expand All @@ -36,9 +42,6 @@ ifeq ($(USEPLUGINASDYLIB),)
USEPLUGINASDYLIB:=FALSE
endif

ifeq ($(THREADING),multi)
APPNAME:=$(APPNAME)MT
endif
ifeq ($(CONFIGURATION),debug)
APP:=$(APPNAME)Debug.app
VM_IDENTIFIER:=$(APPIDENTIFIER)Debug
Expand Down
9 changes: 6 additions & 3 deletions building/macos64x64/common/Makefile.app
Expand Up @@ -26,6 +26,12 @@
ifeq ($(APPNAME),)
APPNAME:=Cocoa
endif
ifeq ($(THREADING),multi)
ifeq ($(APPNAMEDEF),$(APPNAME))
APPNAMEDEF:=$(APPNAMEDEF)MT
endif
APPNAME:=$(APPNAME)MT
endif
ifeq ($(APPNAMEDEF),)
APPNAMEDEF:=$(APPNAME)Fast
endif
Expand All @@ -36,9 +42,6 @@ ifeq ($(USEPLUGINASDYLIB),)
USEPLUGINASDYLIB:=FALSE
endif

ifeq ($(THREADING),multi)
APPNAME:=$(APPNAME)MT
endif
ifeq ($(CONFIGURATION),debug)
APP:=$(APPNAME)Debug.app
VM_IDENTIFIER:=$(APPIDENTIFIER)Debug
Expand Down
7 changes: 7 additions & 0 deletions platforms/Cross/vm/sq.h
Expand Up @@ -349,6 +349,13 @@ int ioNumProcessors(void);
# if !defined(ioTransferTimeslice)
void ioTransferTimeslice(void);
# endif
// If the platform requires events to be accessed from a specific thread (e.g.
// on MacOS events must only be accessed from the main applicaton thread) then
// sqPlatfrormSpecific.h is expected to define ioEventThreadAffinity to answer
// the numberic id of that thread, otherwise it is defined as a no-op here.
# if !defined(ioEventThreadAffinity)
# define ioEventThreadAffinity() -1
#endif
#endif /* COGMTVM */

/* Profiling. */
Expand Down
1 change: 1 addition & 0 deletions platforms/iOS/vm/OSX/sqPlatformSpecific.h
Expand Up @@ -159,6 +159,7 @@ extern const pthread_key_t tltiIndex;
# define ioOSThreadIsAlive(thread) (pthread_kill(thread,0) == 0)
# define ioTransferTimeslice() sched_yield()
# define ioMilliSleep(ms) usleep((ms) * 1000)
# define ioEventThreadAffinity() 1
# endif /* COGMTVM */
#endif /* STACKVM */

Expand Down

0 comments on commit a187764

Please sign in to comment.