2022-03-21 21:11:46 +01:00
|
|
|
/******************************************************************************/
|
|
|
|
/* SlunkCrypt, by LoRd_MuldeR <MuldeR2@GMX.de> */
|
|
|
|
/* This work has been released under the CC0 1.0 Universal license! */
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef INC_SLUNKCRYPT_THREAD_H
|
|
|
|
#define INC_SLUNKCRYPT_THREAD_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-03-24 21:25:32 +01:00
|
|
|
typedef struct thrdpl_data_t thrdpl_t;
|
2022-04-09 16:40:16 +02:00
|
|
|
typedef void(*thrdpl_worker_t)(const size_t thread_count, void *const context, uint8_t *const buffer, const size_t length);
|
|
|
|
|
|
|
|
#ifndef SLUNKBUILD_NOTHREADS
|
|
|
|
|
|
|
|
#define MAX_THREADS 32U
|
2022-03-25 00:42:44 +01:00
|
|
|
thrdpl_t *slunkcrypt_thrdpl_create(const size_t count, const thrdpl_worker_t worker);
|
2022-03-24 21:25:32 +01:00
|
|
|
size_t slunkcrypt_thrdpl_count(const thrdpl_t *const thrdpl);
|
2022-03-25 00:42:44 +01:00
|
|
|
void slunkcrypt_thrdpl_init(thrdpl_t *const thrdpl, const size_t index, void *const context);
|
|
|
|
void slunkcrypt_thrdpl_exec(thrdpl_t *const thrdpl, uint8_t *const buffer, const size_t length);
|
2022-03-24 21:25:32 +01:00
|
|
|
void slunkcrypt_thrdpl_destroy(thrdpl_t *const thrdpl);
|
2022-03-21 21:11:46 +01:00
|
|
|
|
2022-04-09 16:40:16 +02:00
|
|
|
#else
|
|
|
|
|
|
|
|
#define MAX_THREADS 1U
|
|
|
|
#define slunkcrypt_thrdpl_create(X,Y) NULL
|
|
|
|
#define slunkcrypt_thrdpl_count(X) 0U
|
|
|
|
#define slunkcrypt_thrdpl_init(X,Y,Z) do { abort(); } while(0)
|
|
|
|
#define slunkcrypt_thrdpl_exec(X,Y,Z) do { abort(); } while(0)
|
|
|
|
#define slunkcrypt_thrdpl_destroy(X) do { abort(); } while(0)
|
|
|
|
|
|
|
|
#endif
|
2022-03-21 22:45:29 +01:00
|
|
|
#endif
|