我想这是一个愚蠢的问题,但我想做类似的事情
SEM_ID semId;
int main()
{
/* create semaphore */
semId = semCreate();
if (semId != NULL)
{
/* release semaphore which is initially locked! */
semGive(semId);
}
else
{
printf("Failed to create semaphore!\n");
return (ERROR);
}
[...]
}
void someFunction(..)
{
[...]
if (semTake(semId) != ERROR)
{
/* do something only one thread should do at a time! */
semGive(semId);
} /* semTake(semId) */
[...]
}

但它没有用,"无法设置“低”'属性&#34 ;.我知道因为我没有在" Long"建设者,但如果我没有把#34;()"它不工作iven。我对^^'
有点失落对不起我的英文^^'
答案 0 :(得分:4)
您应该使用专门为Mongoose设计的模块,例如mongoose-long
:
var mongoose = require('mongoose')
require('mongoose-long')(mongoose);
var Long = mongoose.Schema.Types.Long;
var UserSchema = new mongoose.Schema({
id : Long,
name : String,
completed : Long,
note : String,
updated_at : { type: Date, default: Date.now },
});