1
0
mirror of synced 2025-12-09 06:38:11 +08:00
Files
SnowFlake-IdGenerator/C/source/YitIdHelper.c
2021-06-28 17:22:45 +08:00

26 lines
651 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 版权属于yitter(yitter@126.com)
* 开源地址https://github.com/yitter/idgenerator
*/
#include <stdlib.h>
#include <stdint.h>
#include "YitIdHelper.h"
#include "idgen/IdGenerator.h"
extern void SetIdGenerator(IdGeneratorOptions options) {
SetOptions(options);
}
extern void SetWorkerId(uint32_t workerId) {
IdGeneratorOptions options = BuildIdGenOptions(workerId);
SetIdGenerator(options);
}
extern int64_t NextId() {
return GetIdGenInstance()->NextId();
// IdGenerator *generator = GetIdGenInstance();
// uint64_t id = generator->NextId();
// free(generator);
// return id;
}