[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Thread.cpp
blob43d9a25baf86009f5c50190cffabb5856726ad30
1 // $Id: Thread.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/Thread.h"
5 ACE_RCSID(ace,
6 Thread,
7 "$Id: Thread.cpp 80826 2008-03-04 14:51:23Z wotte $")
9 #if !defined (__ACE_INLINE__)
10 #include "ace/Thread.inl"
11 #endif /* !defined (__ACE_INLINE__) */
13 #if defined (ACE_HAS_THREADS)
15 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
17 size_t
18 ACE_Thread::spawn_n (size_t n,
19 ACE_THR_FUNC func,
20 void *arg,
21 long flags,
22 long priority,
23 void *stack[],
24 size_t stack_size[],
25 ACE_Thread_Adapter *thread_adapter,
26 const char* thr_name[])
28 ACE_TRACE ("ACE_Thread::spawn_n");
29 ACE_thread_t t_id;
30 size_t i;
32 for (i = 0; i < n; i++)
33 // Bail out if error occurs.
34 if (ACE_OS::thr_create (func,
35 arg,
36 flags,
37 &t_id,
39 priority,
40 stack == 0 ? 0 : stack[i],
41 stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i],
42 thread_adapter,
43 thr_name == 0 ? 0 : &thr_name[i]) != 0)
44 break;
46 return i;
49 size_t
50 ACE_Thread::spawn_n (ACE_thread_t thread_ids[],
51 size_t n,
52 ACE_THR_FUNC func,
53 void *arg,
54 long flags,
55 long priority,
56 void *stack[],
57 size_t stack_size[],
58 ACE_hthread_t thread_handles[],
59 ACE_Thread_Adapter *thread_adapter,
60 const char* thr_name[])
62 ACE_TRACE ("ACE_Thread::spawn_n");
63 size_t i = 0;
65 for (i = 0; i < n; i++)
67 ACE_thread_t t_id;
68 ACE_hthread_t t_handle;
70 int const result =
71 ACE_OS::thr_create (func,
72 arg,
73 flags,
74 &t_id,
75 &t_handle,
76 priority,
77 stack == 0 ? 0 : stack[i],
78 stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i],
79 thread_adapter,
80 thr_name == 0 ? 0 : &thr_name[i]);
82 if (result == 0)
84 if (thread_ids != 0)
85 thread_ids[i] = t_id;
86 if (thread_handles != 0)
87 thread_handles[i] = t_handle;
89 else
90 // Bail out if error occurs.
91 break;
94 return i;
97 ACE_END_VERSIONED_NAMESPACE_DECL
99 #endif /* ACE_HAS_THREADS */