forked from jeffhammond/foMPI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfompi_notif_uq.h
68 lines (53 loc) · 2.13 KB
/
fompi_notif_uq.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* fompi_notif_uq.h
*
* Created on: Jul 14, 2014
* Author: Roberto Belli
*
* Interface that defines all the operation of the discarded notification queue.
*/
#ifndef FOMPI_NOTIF_UQ_H_
#define FOMPI_NOTIF_UQ_H_
#ifdef UGNI
typedef struct fompi_notif_uq fompi_notif_uq_t;
typedef struct fompi_notif_node fompi_notif_node_t;
typedef struct fompi_notif_node {
fompi_notif_node_t *next, *prev;
uint16_t tag;
uint16_t source;
} fompi_notif_node_t;
struct fompi_notif_uq {
fompi_notif_node_t *head, *tail;
unsigned int size;
};
/*creates a new ordered set*/
fompi_notif_uq_t* _fompi_notif_uq_init() ;
/**/
void _fompi_notif_uq_finalize(fompi_notif_uq_t **uq) ;
int _fompi_notif_uq_isEmpty(fompi_notif_uq_t *uq);
/*inserts a new notification in the fompi_uq*/
int _fompi_notif_uq_push(fompi_notif_uq_t *uq, uint16_t source, uint16_t tag);
/*returns _foMPI_NO_MATCH if the uq is empty, otherwise MPI_SUCCESS. In the latter case updates variables source and tag
* with the actual values of the found notification (that is the oldest)*/
int _fompi_notif_uq_pop(fompi_notif_uq_t *uq, uint16_t *source, uint16_t *tag);
/*
* returns MPI_SUCCESS if founds a notification that match the requested tag and source. Removes from the uq the oldest
* notification that matches. Otherwise returns _foMPI_NO_MATCH
* */
int _fompi_notif_uq_search_remove(fompi_notif_uq_t *uq, uint16_t source,uint16_t tag);
/*
* returns MPI_SUCCESS if founds a notification that match the requested tag.
* Updates the variable source with the rank of the sender of the oldest notification that match
* and removes that notification from the uq.
* Otherwise returns _foMPI_NO_MATCH
* */
int _fompi_notif_uq_search_remove_tag(fompi_notif_uq_t *uq, uint16_t tag, uint16_t *source);
/*
* returns MPI_SUCCESS if founds a notification that match the requested source.
* Updates the variable tag with the tag specified by the oldest notification sent by source
* and removes that notification from the uq.
* Otherwise returns _foMPI_NO_MATCH
* */
int _fompi_notif_uq_search_remove_src(fompi_notif_uq_t *uq, uint16_t source, uint16_t *tag) ;
#endif
#endif /* FOMPI_NOTIF_UQ_H_ */