OpenMPI  0.1.1
mtl_portals4_message.h
1 /*
2  * Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
3  * $COPYRIGHT$
4  *
5  * Additional copyrights may follow
6  *
7  * $HEADER$
8  */
9 
10 #ifndef MTL_PORTALS4_MESSAGE_H
11 #define MTL_PORTALS4_MESSAGE_H
12 
15  ptl_event_t ev;
16  void *buffer;
17 };
20 
21 
22 static inline ompi_mtl_portals4_message_t*
23 ompi_mtl_portals4_message_alloc(const ptl_event_t *ev)
24 {
25  int rc;
28 
29  OPAL_FREE_LIST_GET(&ompi_mtl_portals4.fl_message,
30  tmp,
31  rc);
32  if (NULL == tmp) return NULL;
33 
34  message = (ompi_mtl_portals4_message_t*) tmp;
35 
36  message->ev = *ev;
37 
38  if (0 == ev->mlength) {
39  message->buffer = NULL;
40  } else {
41  /* once we've finished processing the event, an AUTO_FREE
42  event might be next, rendering the data in ev.start
43  invalid. Copy it away... */
44  memcpy(message->buffer, ev->start, ev->mlength);
45  message->ev.start = message->buffer;
46  }
47 
48  return message;
49 }
50 
51 static inline void
52 ompi_mtl_portals4_message_free(ompi_mtl_portals4_message_t *message)
53 {
54  OPAL_FREE_LIST_RETURN(&ompi_mtl_portals4.fl_message,
55  &message->super);
56 }
57 
58 #endif
Definition: opal_free_list.h:47
Definition: mtl_portals4_message.h:13
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236