3 //=============================================================================
5 * @file OS_Thread_Adapter.h
7 * @author Carlos O'Ryan <coryan@uci.edu>
9 //=============================================================================
11 #ifndef ACE_OS_THREAD_ADAPTER_H
12 #define ACE_OS_THREAD_ADAPTER_H
13 #include /**/ "ace/pre.h"
15 #include "ace/Base_Thread_Adapter.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include /**/ "ace/ACE_export.h"
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 * @class ACE_OS_Thread_Adapter
28 * @brief Converts a C++ function into a function that can be
29 * called from a thread creation routine
30 * (e.g., pthread_create() or _beginthreadex()) that expects an
31 * extern "C" entry point. This class also makes it possible to
32 * transparently provide hooks to register a thread with an
35 * This class is used in ACE_OS::thr_create(). In general, the
36 * thread that creates an object of this class is different from
37 * the thread that calls invoke() on this object. Therefore,
38 * the invoke() method is responsible for deleting itself.
40 class ACE_Export ACE_OS_Thread_Adapter
: public ACE_Base_Thread_Adapter
44 ACE_OS_Thread_Adapter (ACE_THR_FUNC user_func
,
46 ACE_THR_C_FUNC entry_point
= (ACE_THR_C_FUNC
) ACE_THREAD_ADAPTER_NAME
47 #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS)
48 , ACE_SEH_EXCEPT_HANDLER selector
= 0
49 , ACE_SEH_EXCEPT_HANDLER handler
= 0
50 #endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */
51 , long cancel_flags
= 0);
54 * Execute the @a user_func_ with the @a arg. This function deletes
55 * @c this, thereby rendering the object useless after the call
58 virtual ACE_THR_FUNC_RETURN
invoke ();
60 ACE_ALLOC_HOOK_DECLARE
;
63 /// Ensure that this object is allocated on the heap.
64 ~ACE_OS_Thread_Adapter ();
67 ACE_END_VERSIONED_NAMESPACE_DECL
69 #include /**/ "ace/post.h"
70 #endif /* ACE_THREAD_ADAPTER_H */