[WIP] Continue working on pipeline
This commit is contained in:
1 parent
f8eb98ddf4
commit
daed76f02f
28 files changed
+467
-2156
No files matched your search
@@ -5,9 +5,16 @@
|
||||
|
||||
void read_file(const char* file_name, size_t* bytes_count, char* buffer)
|
||||
{
|
||||
FILE* file;
|
||||
errno_t err = 0;
|
||||
FILE* file = NULL;
|
||||
|
||||
err = fopen_s(&file, file_name, "rb");
|
||||
|
||||
if (0 != err) {
|
||||
perror("Failed to open file");
|
||||
return;
|
||||
}
|
||||
|
||||
file = fopen(file_name, "rb");
|
||||
fseek(file, 0, SEEK_END);
|
||||
*bytes_count = ftell(file);
|
||||
rewind(file);
|
||||
@@ -26,9 +33,15 @@ void read_file(const char* file_name, size_t* bytes_count, char* buffer)
|
||||
|
||||
void write_to_file(const char* file_name, size_t bytes_count, char* buffer)
|
||||
{
|
||||
FILE* file;
|
||||
errno_t err = 0;
|
||||
FILE* file = NULL;
|
||||
|
||||
file = fopen(file_name, "wb");
|
||||
err = fopen_s(&file, file_name, "wb");
|
||||
|
||||
if (0 != err) {
|
||||
perror("Failed to open file.");
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite(buffer, bytes_count, 1, file);
|
||||
fclose(file);
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#include "utilities/task.h"
|
||||
|
||||
uint8_t create_task(thread_t* thread_id, thread_worker_t callback, void* args)
|
||||
{
|
||||
uint8_t result = 0;
|
||||
|
||||
result = pthread_create(thread_id, NULL, callback, args);
|
||||
|
||||
return result; //TODO: Do error handling
|
||||
}
|
||||
|
||||
uint8_t task_join(thread_t* thread_id)
|
||||
{
|
||||
uint8_t result = 0;
|
||||
|
||||
result = pthread_join(*thread_id, NULL);
|
||||
|
||||
return result; //TODO: Do error handling
|
||||
}
|
||||
|
||||
void task_exit()
|
||||
{
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
Reference in new issue
Block a user