mirror of
https://github.com/openappsec/attachment.git
synced 2025-06-28 16:41:03 +03:00
* adding istio files * fix the envoy CMakList file * fix the envoy CMakList file * adding the .mod file * adding the webhook injector image * adding istio files * adding istio files * fix the envoy CMakList file * fix the envoy CMakList file * adding the .mod file * adding the webhook injector image * adding istio files * pulling from dev * fix the envoy CMakList file * adding istio files * fix missing header * fix wrong name of library * fix envoy CMakeLists * remove cloud guard names * remove cloud guard names * adding istio files * adding istio files * [JIRA] INXT-44274: test agent image * add Daniel fixes * remove zlib library * remove nano attachment ut
47 lines
1.3 KiB
C
47 lines
1.3 KiB
C
#ifndef __NANO_ATTACHMENT_THREAD_H__
|
|
#define __NANO_ATTACHMENT_THREAD_H__
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "nano_initializer.h"
|
|
|
|
typedef void *(*CpThreadRoutine)(void *); ///< Func
|
|
|
|
typedef enum TransactionType
|
|
{
|
|
START,
|
|
REQUEST,
|
|
RESPONSE,
|
|
METRICS,
|
|
REGISTRATION
|
|
} TransactionType;
|
|
|
|
///
|
|
/// @brief Runs a function in a thread with a timeout.
|
|
///
|
|
/// This function runs the specified thread function in a dedicated thread with a timeout.
|
|
/// If the function does not complete within the specified timeout, it is cancelled.
|
|
///
|
|
/// @param[in] attachment The NanoAttachment object.
|
|
/// @param[in] data The AttachmentData object.
|
|
/// @param[in] thread_func The function to run in the thread.
|
|
/// @param[in] arg The argument to pass to the thread function.
|
|
/// @param[in] timeout_msecs The timeout value in milliseconds.
|
|
/// @param[in] func_name The name of the function for debugging purposes.
|
|
/// @param[in] transaction_type The type of transaction (request or response), used for timeout.
|
|
///
|
|
/// @return Returns 1 if the function completes within the timeout, 0 otherwise.
|
|
///
|
|
int
|
|
NanoRunInThreadTimeout(
|
|
NanoAttachment *attachment,
|
|
AttachmentData *data,
|
|
CpThreadRoutine thread_func,
|
|
void *arg,
|
|
int timeout_msecs,
|
|
char *func_name,
|
|
TransactionType transaction_type
|
|
);
|
|
|
|
#endif // __NANO_ATTACHMENT_THREAD_H__
|