MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / load_threads

Function load_threads

yolo_detector/darknet_opt/src/data.c:1049–1076  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047}
1048
1049void *load_threads(void *ptr)
1050{
1051 int i;
1052 load_args args = *(load_args *)ptr;
1053 if (args.threads == 0) args.threads = 1;
1054 data *out = args.d;
1055 int total = args.n;
1056 free(ptr);
1057 data *buffers = calloc(args.threads, sizeof(data));
1058 pthread_t *threads = calloc(args.threads, sizeof(pthread_t));
1059 for(i = 0; i < args.threads; ++i){
1060 args.d = buffers + i;
1061 args.n = (i+1) * total/args.threads - i * total/args.threads;
1062 threads[i] = load_data_in_thread(args);
1063 }
1064 for(i = 0; i < args.threads; ++i){
1065 pthread_join(threads[i], 0);
1066 }
1067 *out = concat_datas(buffers, args.threads);
1068 out->shallow = 0;
1069 for(i = 0; i < args.threads; ++i){
1070 buffers[i].shallow = 1;
1071 free_data(buffers[i]);
1072 }
1073 free(buffers);
1074 free(threads);
1075 return 0;
1076}
1077
1078void load_data_blocking(load_args args)
1079{

Callers

nothing calls this directly

Calls 3

load_data_in_threadFunction · 0.85
concat_datasFunction · 0.85
free_dataFunction · 0.85

Tested by

no test coverage detected