25 #define MAX_BACK_OFF_ID 11
27 {0,3,4,7,12,20,33,55,90,148,245};
74 uint8_t *to_free = malloc( 64 *
sizeof( uint8_t ) );
84 memset( to_free, 0 , 64 *
sizeof( uint8_t ));
103 if( 64 < job.entries_count )
105 printf(
"Error maximum Data entries count reached => update value\n");
110 for( i = 0 ; i < job.entries_count ; i++ )
122 for( i = 0 ; i < job.entries_count ; i++ )
124 if( job.entries[i]->been_resubmitted == 0 )
133 job.entries[i] = NULL;
138 job.entries[i]->been_resubmitted = 0;
173 printf(
"%s has been given erroneous arguments\n", __FUNCTION__ );
185 for( i = 0; i < wk_count ; i++ )
190 wk->
threads = malloc( wk_count *
sizeof( pthread_t ) );
193 for( i = 0; i < wk_count ; i++ )
210 pthread_join( wk->
threads[i], NULL );
struct Pbb_workers_desc * descs
the workers descriptors
static void MALP_Blackboard_remove_pending(struct MALP_blackboard *bb)
Decrements the number of pending data block counter.
struct Data_entry ** entries
void Buffered_FIFO_release(struct Buffered_FIFO *fifo, void(*free_func)(void *))
releases a FIFO
This is a struct defining a FIFO It is composed of several Buffered_FIFO_chunk.
int id
the id of the workers
void * Buffered_FIFO_push(struct Buffered_FIFO *fifo, void *elem)
Pushes an element into a FIFO.
void * Buffered_FIFO_pop(struct Buffered_FIFO *fifo, void *dest)
Pops an element from a FIFO.
struct representing a job that does the actual data processing (created by Knowledge_system) ...
void(* default_handler)(struct MALP_blackboard *, uint64_t KS_id, struct Data_entry **, uint32_t, void *arg)
The MALP_blackboard structure.
struct MALP_blackboard * bb
the blackboard where the workers run
static uint64_t MALP_Blackboard_pending(struct MALP_blackboard *bb)
Returns the number of pebnding data block counter.
uint32_t running
indicates if the workers are running or not
static const unsigned int Pbb_workers_backoff_times[MAX_BACK_OFF_ID]
Structure defining a parallel blackboard worker set.
void Data_entry_release(struct Data_entry *de)
Clears a Data_entry.
uint64_t Buffered_FIFO_count(struct Buffered_FIFO *fifo)
Thread-safely gets the number of elements stored in the FIFO.
void * Pbb_workers_mainloop(void *pdesc)
uint32_t worker_count
the number of workers
void Pbb_workers_wait(struct Pbb_workers *wk)
Waits until all workers are done.
void(* process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg)
pthread_t * threads
the threads of the workers
uint64_t ks_type
the type of Knowledge_system
static uint64_t Data_entry_dec_ref_count(struct Data_entry *de)
Decrements the ref_count of a Data_entry.
void Buffered_FIFO_init(struct Buffered_FIFO *fifo, uint64_t chunk_size, size_t elem_size)
Initializes a Buffered_FIFO.
struct Buffered_FIFO * fifos
a set of FIFOs where Knowledge_system_job are stored
void Pbb_workers_submit(struct Pbb_workers *wk, struct Knowledge_system_job *ksj)
sumbits a job on workers
struct Pbb_workers * wk
the workers
void Knowledge_system_job_release(struct Knowledge_system_job *ksj)
Knowledge_system_job_release.
void Pbb_workers_init(struct Pbb_workers *wk, struct MALP_blackboard *bb, uint32_t wk_count)
Initializes workers.
static void Pbb_workers_process(struct MALP_blackboard *bb, struct Knowledge_system_job *job)
void Pbb_workers_release(struct Pbb_workers *wk)
releases workers
structure describing a workers descriptor