Multi-ApplicationOnlineProfiling  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Pbb_Workers.h
Go to the documentation of this file.
1 /* ############################ MALP License ############################## */
2 /* # Fri Jan 18 14:00:00 CET 2013 # */
3 /* # Copyright or (C) or Copr. Commissariat a l'Energie Atomique # */
4 /* # # */
5 /* # This software is governed by the CeCILL-C license under French law # */
6 /* # and abiding by the rules of distribution of free software. You can # */
7 /* # use, modify and/ or redistribute the software under the terms of # */
8 /* # the CeCILL-C license as circulated by CEA, CNRS and INRIA at the # */
9 /* # following URL http://www.cecill.info. # */
10 /* # # */
11 /* # The fact that you are presently reading this means that you have # */
12 /* # had knowledge of the CeCILL-C license and that you accept its # */
13 /* # terms. # */
14 /* # # */
15 /* # Authors: # */
16 /* # - BESNARD Jean-Baptiste jean-baptiste.besnard@cea.fr # */
17 /* # # */
18 /* ######################################################################## */
19 #ifndef PBB_WORKER_H
20 #define PBB_WORKER_H
21 
22 #include <pthread.h>
23 #include <stdint.h>
24 #include <Spinlock.h>
25 
26 #include "Knowledge_System.h"
27 #include "Buffered_FIFO.h"
28 
29 #ifdef __cplusplus
30  extern "C"
31  {
32 #endif
33 
34 
35 struct MALP_blackboard;
36 
42 {
43  int id;
44  struct Pbb_workers *wk;
45 };
46 
47 
53 {
54  uint32_t worker_count;
57  pthread_t *threads;
58  uint32_t running;
60  struct MALP_blackboard *bb;
61  struct Buffered_FIFO *fifos;
62 };
63 
71 void Pbb_workers_init( struct Pbb_workers *wk, struct MALP_blackboard *bb, uint32_t wk_count );
72 
78 void Pbb_workers_release( struct Pbb_workers *wk );
79 
86 void Pbb_workers_submit( struct Pbb_workers *wk, struct Knowledge_system_job *ksj );
87 
93 void Pbb_workers_wait( struct Pbb_workers *wk );
94 
95 #ifdef __cplusplus
96  }
97 #endif
98 
99 #endif
struct Pbb_workers_desc * descs
the workers descriptors
Definition: Pbb_Workers.h:56
This is a struct defining a FIFO It is composed of several Buffered_FIFO_chunk.
int id
the id of the workers
Definition: Pbb_Workers.h:43
struct representing a job that does the actual data processing (created by Knowledge_system) ...
The MALP_blackboard structure.
struct MALP_blackboard * bb
the blackboard where the workers run
Definition: Pbb_Workers.h:60
uint32_t running
indicates if the workers are running or not
Definition: Pbb_Workers.h:58
Structure defining a parallel blackboard worker set.
Definition: Pbb_Workers.h:52
uint32_t worker_count
the number of workers
Definition: Pbb_Workers.h:54
void Pbb_workers_wait(struct Pbb_workers *wk)
Waits until all workers are done.
Definition: Pbb_Workers.c:241
pthread_t * threads
the threads of the workers
Definition: Pbb_Workers.h:57
struct Buffered_FIFO * fifos
a set of FIFOs where Knowledge_system_job are stored
Definition: Pbb_Workers.h:61
void Pbb_workers_submit(struct Pbb_workers *wk, struct Knowledge_system_job *ksj)
sumbits a job on workers
Definition: Pbb_Workers.c:226
struct Pbb_workers * wk
the workers
Definition: Pbb_Workers.h:44
void Pbb_workers_init(struct Pbb_workers *wk, struct MALP_blackboard *bb, uint32_t wk_count)
Initializes workers.
Definition: Pbb_Workers.c:169
void Pbb_workers_release(struct Pbb_workers *wk)
releases workers
Definition: Pbb_Workers.c:203
structure describing a workers descriptor
Definition: Pbb_Workers.h:41