Post

Replies

Boosts

Views

Activity

Reply to POSIX semaphores on iOS
I ran your code under macOS playground no issues. Just doesn't work under an iOS playground. import Foundation func doExternalHardwareInit() {     let sema = sem_open("our.app.group/A", O_CREAT, 0o660, 1)     defer { sem_close(sema) }     guard sema != SEM_FAILED else {         perror("sem_open")         exit(EXIT_FAILURE)     }     print("Waiting for semaphore")     sem_wait(sema) // stuck here     print("Got semaphore")     // run code that must not run multiple times    sem_post(sema) } doExternalHardwareInit()
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’22