View | Details | Raw Unified | Return to bug 1764
Collapse All | Expand All

(-)a/src/core/model/system-mutex.h (-1 / +33 lines)
 Lines 58-63    Link Here 
58
class SystemMutex 
58
class SystemMutex 
59
{
59
{
60
public:
60
public:
61
62
#ifndef HAVE_PTHREAD_H
63
  // This minimal implementation is needed for to support compilation
64
  // of the thread-safe Schedule implementation, on systems without
65
  // thread support.
66
  
67
  /** Constructor */
68
  SystemMutex () { };
69
  /** Destructor */
70
  ~SystemMutex () { };
71
72
#else
61
  SystemMutex ();
73
  SystemMutex ();
62
  ~SystemMutex ();
74
  ~SystemMutex ();
63
75
 Lines 74-79    Link Here 
74
private:
86
private:
75
  /** The (system-dependent) implementation. */
87
  /** The (system-dependent) implementation. */
76
  SystemMutexPrivate * m_priv;
88
  SystemMutexPrivate * m_priv;
89
90
#endif /* HAVE_PTHREAD_H */
77
};
91
};
78
92
79
/**
93
/**
 Lines 118-123    Link Here 
118
class CriticalSection
132
class CriticalSection
119
{
133
{
120
public:
134
public:
135
136
#ifndef HAVE_PTHREAD_H
137
  // This minimal implementation is needed for to support compilation
138
  // of the thread-safe Schedule implementation, on systems without
139
  // thread support.
140
141
  /**
142
   * Constructor
143
   * @param [in] mutex The mutex.
144
   */
145
  CriticalSection (SystemMutex &mutex) { };
146
  /** Destructor */
147
  ~CriticalSection () { };
148
149
#else /* HAVE_PTHREAD_H */
121
  /**
150
  /**
122
   * Construct with the required SystemMutex.
151
   * Construct with the required SystemMutex.
123
   *
152
   *
 Lines 128-134    Link Here 
128
  ~CriticalSection ();
157
  ~CriticalSection ();
129
private:
158
private:
130
  SystemMutex &m_mutex;  /**< The mutex. */
159
  SystemMutex &m_mutex;  /**< The mutex. */
131
};
160
161
#endif /* HAVE_PTHREAD_H */
162
163
};  // class CriticalSection
132
164
133
} // namespace ns3
165
} // namespace ns3
134
166
(-)a/src/core/model/system-thread.h (-5 / +31 lines)
 Lines 57-66    Link Here 
57
{
57
{
58
public:
58
public:
59
59
60
#ifdef HAVE_PTHREAD_H
60
#ifndef HAVE_PTHREAD_H
61
  // This minimal implementation is needed for to support compilation
62
  // of the thread-safe Schedule implementation, on systems without
63
  // thread support.
64
65
  /**
66
   * Fallback type alias for thread objects
67
   * on systems without thread support..
68
   */
69
  typedef void * ThreadId;
70
71
  /**
72
   * @brief Returns the default thread Id on systems without thread support..
73
   *
74
   * @returns Default thread Id. 
75
   */
76
  static ThreadId Self(void) { return 0; };
77
78
  /**
79
   * @brief Compares ThreadIds on systems without thread support.
80
   *
81
   * @param [in] id The ThreadId to compare to.
82
   * @returns @c true if @c id matches the current ThreadId.
83
   */
84
  static bool Equals(ThreadId id) { return true; };
85
  
86
#else /* HAVE_PTHREAD_H */
61
  /** Type alias for the system-dependent thread object. */
87
  /** Type alias for the system-dependent thread object. */
62
  typedef pthread_t ThreadId;
88
  typedef pthread_t ThreadId;
63
#endif
64
89
65
  /**
90
  /**
66
   * @brief Create a SystemThread object.
91
   * @brief Create a SystemThread object.
 Lines 157-163    Link Here 
157
  static bool Equals(ThreadId id);
182
  static bool Equals(ThreadId id);
158
183
159
private:
184
private:
160
#ifdef HAVE_PTHREAD_H
185
161
  /**
186
  /**
162
   * Invoke the callback in the new thread.
187
   * Invoke the callback in the new thread.
163
   *
188
   *
 Lines 168-175    Link Here 
168
193
169
  Callback<void> m_callback;  /**< The main function for this thread when launched. */
194
  Callback<void> m_callback;  /**< The main function for this thread when launched. */
170
  pthread_t m_thread;  /**< The thread id of the child thread. */
195
  pthread_t m_thread;  /**< The thread id of the child thread. */
171
#endif 
196
172
};
197
#endif /* HAVE_PTHREAD_H */
198
};  // class SystemThread
173
199
174
} // namespace ns3
200
} // namespace ns3
175
201
(-)a/src/core/wscript (-2 / +12 lines)
 Lines 236-241    Link Here 
236
        'model/watchdog.h',
236
        'model/watchdog.h',
237
        'model/synchronizer.h',
237
        'model/synchronizer.h',
238
        'model/make-event.h',
238
        'model/make-event.h',
239
        
240
        # Include always for compilation
241
        # of the thread-safe Schedule implementation,
242
        # on systems without thread support.
243
        'model/system-mutex.h',
244
        'model/system-thread.h',
245
        
239
        'model/system-wall-clock-ms.h',
246
        'model/system-wall-clock-ms.h',
240
        'model/empty.h',
247
        'model/empty.h',
241
        'model/callback.h',
248
        'model/callback.h',
 Lines 350-357    Link Here 
350
        core_test.source.extend(['test/threaded-test-suite.cc'])
357
        core_test.source.extend(['test/threaded-test-suite.cc'])
351
        headers.source.extend([
358
        headers.source.extend([
352
                'model/unix-fd-reader.h',
359
                'model/unix-fd-reader.h',
353
                'model/system-mutex.h',
360
                # Include always for compilation
354
                'model/system-thread.h',
361
                # of the thread-safe Schedule implementation,
362
                # on systems without thread support.
363
                # 'model/system-mutex.h',
364
                # 'model/system-thread.h',
355
                'model/system-condition.h',
365
                'model/system-condition.h',
356
                ])
366
                ])
357
367

Return to bug 1764