Skip to content

Commit 6f04f11

Browse files
authored
posix_thread.c: Avoid sem_getvalue deprecation warning on macOS (#1596)
1 parent 02f0c2b commit 6f04f11

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/shared/platform/common/posix/posix_thread.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,17 @@ os_sem_post(korp_sem *sem)
228228
int
229229
os_sem_getvalue(korp_sem *sem, int *sval)
230230
{
231+
#if defined(__APPLE__)
232+
/*
233+
* macOS doesn't have working sem_getvalue.
234+
* It's marked as deprecated in the system header.
235+
* Mock it up here to avoid compile-time deprecation warnings.
236+
*/
237+
errno = ENOSYS;
238+
return -1;
239+
#else
231240
return sem_getvalue(sem, sval);
241+
#endif
232242
}
233243

234244
int

0 commit comments

Comments
 (0)