1
0
Fork 0

Added flag to indicate multi-thread support to the public API.

This commit is contained in:
LoRd_MuldeR 2022-09-22 00:49:55 +02:00
parent c4b869981f
commit d988fd0a56
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
5 changed files with 11 additions and 10 deletions

View File

@ -154,7 +154,8 @@ int MAIN(const int argc, CHR *const argv[])
setup_signal_handler(SIGINT, sigint_handler);
FPRINTF(stderr, T("SlunkCrypt Utility (%") T(PRIstr) T("-%") T(PRIstr) T("), by LoRd_MuldeR <MuldeR2@GMX.de>\n"), OS_TYPE_NAME, CPU_ARCH);
FPRINTF(stderr, T("Using libSlunkCrypt v%u.%u.%u [%") T(PRIstr) T("]\n\n"), SLUNKCRYPT_VERSION_MAJOR, SLUNKCRYPT_VERSION_MINOR, SLUNKCRYPT_VERSION_PATCH, SLUNKCRYPT_BUILD);
FPRINTF(stderr, T("Using libSlunkCrypt-%") T(PRIstr) T(" v%u.%u.%u [%") T(PRIstr) T("]\n\n"),
SLUNKCRYPT_HAVE_THREADS ? "MT" : "ST", SLUNKCRYPT_VERSION_MAJOR, SLUNKCRYPT_VERSION_MINOR, SLUNKCRYPT_VERSION_PATCH, SLUNKCRYPT_BUILD);
fflush(stderr);

View File

@ -98,6 +98,11 @@ SLUNKCRYPT_API extern const uint16_t SLUNKCRYPT_VERSION_PATCH;
*/
SLUNKCRYPT_API extern const char *const SLUNKCRYPT_BUILD;
/*
* Configuration
*/
SLUNKCRYPT_API extern const int SLUNKCRYPT_HAVE_THREADS;
/*
* Abort flag
*/

View File

@ -24,6 +24,9 @@ const char *const SLUNKCRYPT_BUILD = __DATE__ ", " __TIME__;
#define BOOLIFY(X) (!!(X))
#define THREAD_COUNT(X) (((X)->thread_pool) ? slunkcrypt_thrdpl_count((X)->thread_pool) : 1U)
/* Configuration */
const int SLUNKCRYPT_HAVE_THREADS = BOOLIFY(MAX_THREADS > 1U);
// ==========================================================================
// Data structures
// ==========================================================================

View File

@ -3,13 +3,7 @@
/* This work has been released under the CC0 1.0 Universal license! */
/******************************************************************************/
#ifdef SLUNKBUILD_NOTHREADS
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wpedantic"
#endif
#else /*SLUNKBUILD_NOTHREADS*/
#ifndef SLUNKBUILD_NOTHREADS
#ifdef _WIN32
# define _CRT_SECURE_NO_WARNINGS 1

View File

@ -15,7 +15,6 @@ typedef void(*thrdpl_worker_t)(const size_t thread_count, void *const context, u
#ifndef SLUNKBUILD_NOTHREADS
#define MAX_THREADS 32U
thrdpl_t *slunkcrypt_thrdpl_create(const size_t count, const thrdpl_worker_t worker);
size_t slunkcrypt_thrdpl_count(const thrdpl_t *const thrdpl);
void slunkcrypt_thrdpl_init(thrdpl_t *const thrdpl, const size_t index, void *const context);
@ -25,7 +24,6 @@ void slunkcrypt_thrdpl_destroy(thrdpl_t *const thrdpl);
#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)