Skip to content

Commit 5e280cd

Browse files
committed
Latest and greatest. Now OPAL is ready for the Windows prime-time.
The same treatement will happens on all sub-projects. The .h files have to be C++ compatibles and all symbols with an external visibility have to get the {PROJECT}_DECLSPEC in front of the prototype. This commit was SVN r11340.
1 parent b20cdbc commit 5e280cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+547
-545
lines changed

opal/class/opal_atomic_lifo.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2005 The University of Tennessee and The University
5+
* Copyright (c) 2004-2006 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -23,7 +23,11 @@
2323
#include "opal/class/opal_list.h"
2424
#include "opal/sys/atomic.h"
2525

26-
/* Atomic Last In First Out lists. If we are in a multi-threaded environment then the
26+
#if defined(c_plusplus) || defined(__cplusplus)
27+
extern "C" {
28+
#endif
29+
30+
/* Atomic Last In First Out lists. If we are in a multi-threaded environment then the
2731
* atomicity is insured via the compare-and-swap operation, if not we simply do a read
2832
* and/or a write.
2933
*
@@ -99,5 +103,9 @@ static inline opal_list_item_t* opal_atomic_lifo_pop( opal_atomic_lifo_t* lifo )
99103
return item;
100104
}
101105

106+
#if defined(c_plusplus) || defined(__cplusplus)
107+
}
108+
#endif
109+
102110
#endif /* OPAL_ATOMIC_LIFO_H_HAS_BEEN_INCLUDED */
103111

opal/class/opal_free_list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2005 The University of Tennessee and The University
5+
* Copyright (c) 2004-2006 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -102,7 +102,7 @@ int opal_free_list_grow(opal_free_list_t* flist, size_t num_elements)
102102
opal_list_append(&(flist->fl_allocations), (opal_list_item_t*) alloc_ptr);
103103
ptr = alloc_ptr + sizeof(opal_list_item_t);
104104

105-
mod = (unsigned long)ptr % CACHE_LINE_SIZE;
105+
mod = (intptr_t)ptr % CACHE_LINE_SIZE;
106106
if(mod != 0) {
107107
ptr += (CACHE_LINE_SIZE - mod);
108108
}

opal/class/opal_free_list.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2005 The University of Tennessee and The University
5+
* Copyright (c) 2004-2006 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -44,14 +44,14 @@ struct opal_free_list_t
4444
opal_list_t fl_allocations;
4545
};
4646
typedef struct opal_free_list_t opal_free_list_t;
47-
OBJ_CLASS_DECLARATION(opal_free_list_t);
47+
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_free_list_t);
4848

4949
struct opal_free_list_item_t
5050
{
5151
opal_list_item_t super;
5252
};
5353
typedef struct opal_free_list_item_t opal_free_list_item_t;
54-
OBJ_CLASS_DECLARATION(opal_free_list_item_t);
54+
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_free_list_item_t);
5555

5656
/**
5757
* Initialize a free list.

opal/class/opal_list.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ typedef struct opal_list_t opal_list_t;
172172
static inline bool opal_list_is_empty(opal_list_t* list)
173173
{
174174
return (list->opal_list_sentinel.opal_list_next ==
175-
&(list->opal_list_sentinel));
175+
&(list->opal_list_sentinel) ? true : false);
176176
}
177177

178178

@@ -682,8 +682,8 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos
682682
* If index is greater than the length of the list, no action is
683683
* performed and false is returned.
684684
*/
685-
bool opal_list_insert(opal_list_t *list, opal_list_item_t *item,
686-
long long idx);
685+
OPAL_DECLSPEC bool opal_list_insert(opal_list_t *list, opal_list_item_t *item,
686+
long long idx);
687687

688688

689689
/**
@@ -703,8 +703,8 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos
703703
* containers remain valid, including those that point to elements
704704
* in \c xlist.
705705
*/
706-
void opal_list_join(opal_list_t *thislist, opal_list_item_t *pos,
707-
opal_list_t *xlist);
706+
OPAL_DECLSPEC void opal_list_join(opal_list_t *thislist, opal_list_item_t *pos,
707+
opal_list_t *xlist);
708708

709709

710710
/**
@@ -730,9 +730,9 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos
730730
* This is an O(N) operation because the length of both lists must
731731
* be recomputed.
732732
*/
733-
void opal_list_splice(opal_list_t *thislist, opal_list_item_t *pos,
734-
opal_list_t *xlist, opal_list_item_t *first,
735-
opal_list_item_t *last);
733+
OPAL_DECLSPEC void opal_list_splice(opal_list_t *thislist, opal_list_item_t *pos,
734+
opal_list_t *xlist, opal_list_item_t *first,
735+
opal_list_item_t *last);
736736

737737
/**
738738
* Comparison function for opal_list_sort(), below.
@@ -793,7 +793,7 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos
793793
* whatever the underlying type is). See the documentation of
794794
* opal_list_item_compare_fn_t for an example).
795795
*/
796-
int opal_list_sort(opal_list_t* list, opal_list_item_compare_fn_t compare);
796+
OPAL_DECLSPEC int opal_list_sort(opal_list_t* list, opal_list_item_compare_fn_t compare);
797797

798798
#if defined(c_plusplus) || defined(__cplusplus)
799799
}

opal/class/opal_object.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2005 The University of Tennessee and The University
5+
* Copyright (c) 2004-2006 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -119,7 +119,9 @@
119119
#include <stdlib.h>
120120
#endif /* HAVE_STDLIB_H */
121121

122+
#if OMPI_HAVE_THREAD_SUPPORT
122123
#include "opal/sys/atomic.h"
124+
#endif /* OMPI_HAVE_THREAD_SUPPORT */
123125

124126
/*
125127
* BEGIN_C_DECLS should be used at the beginning of your declarations,
@@ -333,8 +335,8 @@ do { \
333335
} while (0)
334336

335337
BEGIN_C_DECLS
336-
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_object_t);
337338

339+
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_object_t);
338340

339341
/* declarations *******************************************************/
340342

opal/class/opal_value_array.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2005 The University of Tennessee and The University
5+
* Copyright (c) 2004-2006 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -39,9 +39,6 @@
3939
extern "C" {
4040
#endif
4141

42-
OPAL_DECLSPEC extern opal_class_t opal_value_array_t_class;
43-
44-
4542
struct opal_value_array_t
4643
{
4744
opal_object_t super;
@@ -52,7 +49,7 @@ struct opal_value_array_t
5249
};
5350
typedef struct opal_value_array_t opal_value_array_t;
5451

55-
52+
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_value_array_t);
5653

5754
/**
5855
* Initialize the array to hold items by value. This routine must
@@ -129,7 +126,7 @@ static inline size_t opal_value_array_get_size(opal_value_array_t* array)
129126
* return the new size.
130127
*/
131128

132-
int opal_value_array_set_size(opal_value_array_t* array, size_t size);
129+
OPAL_DECLSPEC int opal_value_array_set_size(opal_value_array_t* array, size_t size);
133130

134131

135132
/**

opal/event/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch)
343343
int n = EVBUFFER_MAX_READ;
344344
#endif
345345

346-
#ifdef FIONREAD
346+
#if !defined(__WINDOWS__) && defined(FIONREAD)
347347
#ifdef WIN32
348348
if (ioctlsocket(fd, FIONREAD, &n) == -1 || n == 0) {
349349
#else

opal/event/evbuffer.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ bufferevent_writecb(int fd, short event, void *arg)
155155
if (res == -1) {
156156
if (errno == EAGAIN ||
157157
errno == EINTR ||
158-
errno == EINPROGRESS)
158+
#if !defined(__WINDOWS__)
159+
errno == EINPROGRESS
160+
#else
161+
0
162+
#endif /* !defined(__WINDOWS__) */
163+
)
159164
goto reschedule;
160165
/* error case */
161166
what |= OPAL_EVBUFFER_ERROR;

opal/event/event.c

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,6 @@ extern const struct opal_eventop opal_kqops;
8282
extern const struct opal_eventop devpollops;
8383
#endif
8484

85-
#if 0
86-
/* This is to prevent event library from picking up the win32_ops
87-
since this will be picked up over select(). By using select, we can
88-
pretty much use the OOB and PTL as is. Otherwise, there would have
89-
to be a lot of magic to be done to get this to work */
90-
#if defined(WIN32) && WIN32
91-
extern const struct opal_eventop opal_win32ops;
92-
#endif
93-
#endif
94-
9585
/* In order of preference */
9686
static const struct opal_eventop *eventops[] = {
9787
#if 0 /* no KQUEUE or EPOLL support for us -- neither seem to work
@@ -119,16 +109,18 @@ static const struct opal_eventop *eventops[] = {
119109
#if defined(HAVE_SELECT) && HAVE_SELECT
120110
&opal_selectops,
121111
#endif
122-
#if 0
123-
/* This is to prevent event library from picking up the
124-
win32_ops since this will be picked up over select(). By
125-
using select, we can pretty much use the OOB and PTL as
126-
is. Otherwise, there would have to be a lot of magic to be
127-
done to get this to work */
128-
#if defined(WIN32) && WIN32
112+
/**
113+
* One of the most stupid comment in the libevent project. Why ? How ?
114+
*
115+
* This is to prevent event library from picking up the
116+
* win32_ops since this will be picked up over select(). By
117+
* using select, we can pretty much use the OOB and PTL as
118+
* is. Otherwise, there would have to be a lot of magic to be
119+
* done to get this to work
120+
*/
121+
#if defined(__WINDOWS__)
129122
&opal_win32ops,
130-
#endif
131-
#endif
123+
#endif /* defined(__WINDOWS__) */
132124
NULL
133125
};
134126

@@ -149,8 +141,6 @@ static int opal_event_haveevents(struct event_base *);
149141

150142
static void opal_event_process_active(struct event_base *);
151143

152-
extern int opal_evsignal_restart(void);
153-
154144
static int timeout_next(struct event_base *, struct timeval *);
155145
static void timeout_process(struct event_base *);
156146
static void timeout_correct(struct event_base *, struct timeval *);
@@ -237,7 +227,7 @@ opal_event_init(void)
237227

238228
#if OPAL_HAVE_WORKING_EVENTOPS
239229

240-
if ((current_base = calloc(1, sizeof(struct event_base))) == NULL)
230+
if ((current_base = (event_base*)calloc(1, sizeof(struct event_base))) == NULL)
241231
event_err(1, "%s: calloc");
242232

243233
event_sigcb = NULL;
@@ -362,7 +352,7 @@ int opal_event_disable(void)
362352

363353
int opal_event_restart(void)
364354
{
365-
#if OPAL_HAVE_WORKING_EVENTOPS
355+
#if OPAL_HAVE_WORKING_EVENTOPS && !defined(__WINDOWS__)
366356
int rc;
367357
#if OMPI_ENABLE_PROGRESS_THREADS
368358
opal_mutex_lock(&opal_event_lock);
@@ -379,8 +369,10 @@ int opal_event_restart(void)
379369
#endif
380370

381371
opal_event_enable();
372+
#if !defined(__WINDOWS__)
382373
if((rc = opal_evsignal_restart()) != 0)
383374
return OPAL_ERROR;
375+
#endif /* defined(__WINDOWS__) */
384376
return (OPAL_SUCCESS);
385377
#else /* OPAL_HAVE_WORKING_EVENTOPS */
386378
return OPAL_ERR_NOT_SUPPORTED;
@@ -568,7 +560,7 @@ opal_event_base_loop(struct event_base *base, int flags)
568560
}
569561
}
570562
}
571-
563+
#if !defined(__WINDOWS__)
572564
/* Check if time is running backwards */
573565
gettimeofday(&tv, NULL);
574566
if (timercmp(&tv, &base->event_tv, <)) {
@@ -579,7 +571,7 @@ opal_event_base_loop(struct event_base *base, int flags)
579571
timeout_correct(base, &off);
580572
}
581573
base->event_tv = tv;
582-
574+
#endif /* !defined(__WINDOWS__) */
583575
if (!base->event_count_active && !(flags & OPAL_EVLOOP_NONBLOCK))
584576
timeout_next(base, &tv);
585577
else

0 commit comments

Comments
 (0)