#include <iostream>
#include <thread>
#include "Abnormality.h"
int _stdcall video_work(void*arg)
{
FILE *fp = (FILE *)arg;
int index = 100;
while (index--)
{
bugs(fp," i=%d\n", index);
}
return 0;
}
int main()
{
FILE *fp = NULL;
fopen_s(&fp, f_PATH_TYPE);
void * index = nullptr;
int length = 100;
for (size_t i = 0; i < length; i++)
{
index = &i;
std::thread th(video_work, fp);
th.detach();
}
fclose(fp), fp = NULL;
std::cout << "Hello World!\n";
}
#ifndef _ABNORMALITY_H_
#define _ABNORMALITY_H_
#ifdef __cplusplus
/** Macro to start a block of C symbols */
# define _C_START_ extern "C" {
/** Macro to end a block of C symbols */
# define _C_END_ }
#else
# define _C_START_
# define _C_END_
#endif
#define __DLL___
#ifdef __DLL___
#define DLL_ __declspec(dllexport)
#else
#define DLL_ __declspec(dllimport)
#endif
#define f_PATH_TYPE "log_info.log", "a+"
#define FFL __FUNCTION__, __LINE__
#define FFLDT FFL, __DATE__, __TIME__
#define FFL_X __FILE__, FFLDT
/** 本地文件写debug */
#define bugs(fp,s, ...) fprintf(fp, "%s()#%d %s %s" s, FFLDT, ##__VA_ARGS__);
/** 本地文件写error */
#define log(fp,s) fprintf(fp, "%s()#%d %s %s %s\n", FFLDT,s);
#define logfsx(fp,s, ...) fprintf(fp, "%s %s()#%d %s %s\n"s, FFL_X, ##__VA_ARGS__);
_C_START_
_C_END_
#endif