homework-jianmu/source/libs/sync/test/syncTest.cpp

37 lines
556 B
C++

#include <stdio.h>
#include "syncIO.h"
#include "syncInt.h"
void *pingFunc(void *param) {
SSyncIO *io = (SSyncIO *)param;
while (1) {
sDebug("io->ping");
io->ping(io);
sleep(1);
}
return NULL;
}
int main() {
tsAsyncLog = 0;
taosInitLog((char *)"syncTest.log", 100000, 10);
sDebug("sync test");
syncStartEnv();
SSyncIO *syncIO = syncIOCreate();
assert(syncIO != NULL);
syncIO->start(syncIO);
sleep(2);
pthread_t tid;
pthread_create(&tid, NULL, pingFunc, syncIO);
while (1) {
sleep(1);
}
return 0;
}