-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (34 loc) · 975 Bytes
/
main.cpp
File metadata and controls
46 lines (34 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include "clyp.h"
using namespace std;
int x = 0;
void progress(int total) {
x = total;
cout << "Progress: " << x << "%" << endl;
}
void success(string audioFileId, string title, string url) {
cout << "Finished uploading. AudioFileId: " << audioFileId << endl;
}
void error(string errorMessage) {
cout << "Failed to upload. Error: " << errorMessage << endl;
}
int main() {
progress(x);
cout << "" << endl;
struct upload_args args;
args.file_path = "audio.mp4";
args.title = "Test";
args.description = "Describing!";
args.success = success;
args.error = error;
args.progress = progress;
pthread_t thread;
if (pthread_create(&thread, NULL, &upload, (void *)&args) != 0) {
printf("Failed to create thread!\n");
return -1;
}
cout << "Parent waiting to exit!" << endl;
int code = pthread_join(thread, NULL);
cout << "X = " << x << endl;
return code;
}