CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
wait_handle.h
1
2#ifndef _system_threading_wait_handle_h_
3#define _system_threading_wait_handle_h_
4
5#include "system/object.h"
6#include "system/array.h"
7#include "system/timespan.h"
8
9
10namespace System{ namespace Threading{
11
13typedef void * wait_handle_t;
14
19class ASPOSECPP_SHARED_CLASS WaitHandle : public System::Object //public EventWaitHandle
20{
22 RTTI_INFO(System::Threading::WaitHandle, ::System::BaseTypesInfo<System::Object>);
23public:
28 static ASPOSECPP_SHARED_API bool WaitAll(const System::ArrayPtr<System::SharedPtr<WaitHandle>>& waitHandles, int millisecondsTimeout);
33 static ASPOSECPP_SHARED_API bool WaitAll(const System::ArrayPtr<System::SharedPtr<WaitHandle>>& waitHandles, TimeSpan timeout);
37 static ASPOSECPP_SHARED_API bool WaitAll(const System::ArrayPtr<System::SharedPtr<WaitHandle>>& waitHandles);
38
43 static ASPOSECPP_SHARED_API int WaitAny(const System::ArrayPtr<System::SharedPtr<WaitHandle>>& waitHandles, int millisecondsTimeout);
48 static ASPOSECPP_SHARED_API int WaitAny(const System::ArrayPtr<System::SharedPtr<WaitHandle>>& waitHandles, TimeSpan timeout);
52 static ASPOSECPP_SHARED_API int WaitAny(const System::ArrayPtr<System::SharedPtr<WaitHandle>>& waitHandles);
53
56 virtual ASPOSECPP_SHARED_API bool WaitOne();
60 virtual ASPOSECPP_SHARED_API bool WaitOne(int millisecondsTimeout);
64 virtual ASPOSECPP_SHARED_API bool WaitOne(TimeSpan timeout);
69 virtual ASPOSECPP_SHARED_API bool WaitOne(int millisecondsTimeout, bool exitContext);
70
72 virtual ASPOSECPP_SHARED_API ~WaitHandle();
74 virtual ASPOSECPP_SHARED_API void Close();
75
78 ASPOSECPP_SHARED_API wait_handle_t get_Handle();
79
81 static ASPOSECPP_SHARED_API const int WaitTimeout = 0x102;
82
83protected:
90 static ASPOSECPP_SHARED_API int WaitMultiple(const System::ArrayPtr<System::SharedPtr<WaitHandle>>& waitHandles, int millisecondsTimeout, bool waitAll, int& index);
91
94 ASPOSECPP_SHARED_API WaitHandle(wait_handle_t handle);
95
99 static ASPOSECPP_SHARED_API void CheckIsValidTimeout(TimeSpan timeout);
100
101private:
103 wait_handle_t m_wait_handle = 0;
104
105};
106
107}} // namespace System{ namespace Threading{
108
109#endif // _system_threading_wait_handle_h_
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Waiting primitive base class. Objects of this class should only be allocated using System::MakeObject...
Definition: wait_handle.h:20
static void CheckIsValidTimeout(TimeSpan timeout)
Checks that the timeout parameter is not greater than the INT32_MAX value.
static bool WaitAll(const System::ArrayPtr< System::SharedPtr< WaitHandle > > &waitHandles, int millisecondsTimeout)
Waits for all handles to fire.
static int WaitMultiple(const System::ArrayPtr< System::SharedPtr< WaitHandle > > &waitHandles, int millisecondsTimeout, bool waitAll, int &index)
Implementation of waiting for multiple objects.
static int WaitAny(const System::ArrayPtr< System::SharedPtr< WaitHandle > > &waitHandles)
Waits for any of the handles to fire.
virtual bool WaitOne(TimeSpan timeout)
Waits for the handle to fire.
virtual bool WaitOne(int millisecondsTimeout, bool exitContext)
Waits for the handle to fire.
WaitHandle(wait_handle_t handle)
Constructor.
static bool WaitAll(const System::ArrayPtr< System::SharedPtr< WaitHandle > > &waitHandles)
Waits for all handles to fire.
static int WaitAny(const System::ArrayPtr< System::SharedPtr< WaitHandle > > &waitHandles, int millisecondsTimeout)
Waits for any of the handles to fire.
virtual void Close()
Releases any resource associated with handle.
static bool WaitAll(const System::ArrayPtr< System::SharedPtr< WaitHandle > > &waitHandles, TimeSpan timeout)
Waits for all handles to fire.
virtual bool WaitOne()
Waits for the handle to fire for unlimited period.
virtual bool WaitOne(int millisecondsTimeout)
Waits for the handle to fire.
virtual ~WaitHandle()
Destructor.
wait_handle_t get_Handle()
Gets handle.
static int WaitAny(const System::ArrayPtr< System::SharedPtr< WaitHandle > > &waitHandles, TimeSpan timeout)
Waits for any of the handles to fire.
Represents a time interval. This type should be allocated on stack and passed to functions by value o...
Definition: timespan.h:59
void * wait_handle_t
Handle type.
Definition: wait_handle.h:13
Definition: db_command.h:9