Unity c# 空指针

Posix semaphore blocked by Mac Store sandbox

lyo posted @ 2013年5月04日 11:53 in Coding with tags mac , 1972 阅读

sem_open无法在Mac Store App中使用,会被sandbox denied,需要额外的权限,为保险起见,还是不要使用,免得被Apple拒了

以下代码无法通过

#include <semaphore.h>

sem_t * pSemaphore = sem_open(name, O_CREAT, 0777, 1);
if (pSemaphore == (sem_t *)SEM_FAILED)
{
    //... 
}

用pthread_mutex替代

#include <pthread.h>

pthread_mutex_t* pSemaphore = (pthread_mutex_t *)BL_MALLOC(sizeof(pthread_mutex_t));
int ret = pthread_mutex_init(pSemaphore, NULL);
if (ret != 0)
{
    //... 
}

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter