Fixed typos
[ACE_TAO.git] / ACE / ace / Thread.cpp
blobc8ff2e3bfad1f2ce5dd0f31a93eff49d7b873d0e
1 #include "ace/Thread.h"
3 #if !defined (__ACE_INLINE__)
4 #include "ace/Thread.inl"
5 #endif /* !defined (__ACE_INLINE__) */
7 #if defined (ACE_HAS_THREADS)
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 size_t
12 ACE_Thread::spawn_n (size_t n,
13 ACE_THR_FUNC func,
14 void *arg,
15 long flags,
16 long priority,
17 void *stack[],
18 size_t stack_size[],
19 ACE_Thread_Adapter *thread_adapter,
20 const char* thr_name[])
22 ACE_TRACE ("ACE_Thread::spawn_n");
23 size_t i;
25 for (i = 0; i < n; i++)
27 ACE_thread_t t_id;
28 // Bail out if error occurs.
29 if (ACE_OS::thr_create (func,
30 arg,
31 flags,
32 &t_id,
34 priority,
35 stack == 0 ? 0 : stack[i],
36 stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i],
37 thread_adapter,
38 thr_name == 0 ? 0 : &thr_name[i]) != 0)
39 break;
42 return i;
45 size_t
46 ACE_Thread::spawn_n (ACE_thread_t thread_ids[],
47 size_t n,
48 ACE_THR_FUNC func,
49 void *arg,
50 long flags,
51 long priority,
52 void *stack[],
53 size_t stack_size[],
54 ACE_hthread_t thread_handles[],
55 ACE_Thread_Adapter *thread_adapter,
56 const char* thr_name[])
58 ACE_TRACE ("ACE_Thread::spawn_n");
59 size_t i = 0;
61 for (i = 0; i < n; i++)
63 ACE_thread_t t_id;
64 ACE_hthread_t t_handle;
66 int const result =
67 ACE_OS::thr_create (func,
68 arg,
69 flags,
70 &t_id,
71 &t_handle,
72 priority,
73 stack == 0 ? 0 : stack[i],
74 stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i],
75 thread_adapter,
76 thr_name == 0 ? 0 : &thr_name[i]);
78 if (result == 0)
80 if (thread_ids != 0)
81 thread_ids[i] = t_id;
82 if (thread_handles != 0)
83 thread_handles[i] = t_handle;
85 else
86 // Bail out if error occurs.
87 break;
90 return i;
93 ACE_END_VERSIONED_NAMESPACE_DECL
95 #endif /* ACE_HAS_THREADS */