2019-02-27 21:10:52 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Protocol Parallel Executor
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
#ifndef PROTOCOL_PARALLEL_H
|
|
|
|
#define PROTOCOL_PARALLEL_H
|
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Object type
|
|
|
|
***********************************************************************************************************************************/
|
2019-05-03 18:52:54 -04:00
|
|
|
#define PROTOCOL_PARALLEL_TYPE ProtocolParallel
|
|
|
|
#define PROTOCOL_PARALLEL_PREFIX protocolParallel
|
|
|
|
|
2019-02-27 21:10:52 +02:00
|
|
|
typedef struct ProtocolParallel ProtocolParallel;
|
|
|
|
|
|
|
|
#include "common/time.h"
|
|
|
|
#include "protocol/client.h"
|
|
|
|
#include "protocol/parallelJob.h"
|
|
|
|
|
2019-09-18 07:15:16 -04:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Job request callback
|
|
|
|
|
|
|
|
Called whenever a new job is required for processing. If no more jobs are available then NULL is returned. Note that NULL must be
|
|
|
|
returned to each clientIdx in case job distribution varies by clientIdx.
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
typedef ProtocolParallelJob *ParallelJobCallback(void *data, unsigned int clientIdx);
|
|
|
|
|
2019-02-27 21:10:52 +02:00
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Constructor
|
|
|
|
***********************************************************************************************************************************/
|
2019-09-18 07:15:16 -04:00
|
|
|
ProtocolParallel *protocolParallelNew(TimeMSec timeout, ParallelJobCallback *callbackFunction, void *callbackData);
|
2019-02-27 21:10:52 +02:00
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Functions
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
void protocolParallelClientAdd(ProtocolParallel *this, ProtocolClient *client);
|
|
|
|
unsigned int protocolParallelProcess(ProtocolParallel *this);
|
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Getters
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
bool protocolParallelDone(const ProtocolParallel *this);
|
|
|
|
ProtocolParallelJob *protocolParallelResult(ProtocolParallel *this);
|
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Destructor
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
void protocolParallelFree(ProtocolParallel *this);
|
|
|
|
|
|
|
|
/***********************************************************************************************************************************
|
|
|
|
Macros for function logging
|
|
|
|
***********************************************************************************************************************************/
|
|
|
|
String *protocolParallelToLog(const ProtocolParallel *this);
|
|
|
|
|
|
|
|
#define FUNCTION_LOG_PROTOCOL_PARALLEL_TYPE \
|
|
|
|
ProtocolParallel *
|
|
|
|
#define FUNCTION_LOG_PROTOCOL_PARALLEL_FORMAT(value, buffer, bufferSize) \
|
|
|
|
FUNCTION_LOG_STRING_OBJECT_FORMAT(value, protocolParallelToLog, buffer, bufferSize)
|
|
|
|
|
|
|
|
#endif
|