28 #if !defined(_WIN32) || _MSC_VER < 1800 || CPPREST_FORCE_PPLX
30 #include "cpprest/details/cpprest_compat.h"
31 #include "pplx/pplxinterface.h"
43 _PPLXIMP
long __cdecl GetCurrentThreadId();
48 _PPLXIMP
void __cdecl YieldExecution();
53 __declspec(noinline) _PPLXIMP
size_t __cdecl CaptureCallstack(
void **,
size_t,
size_t);
55 #if defined(__cplusplus_winrt)
59 _PPLXIMP
unsigned int __cdecl GetNextAsyncId();
70 static const unsigned int timeout_infinite = 0xFFFFFFFF;
72 _PPLXIMP event_impl();
74 _PPLXIMP ~event_impl();
78 _PPLXIMP
void reset();
80 _PPLXIMP
unsigned int wait(
unsigned int timeout);
84 return wait(event_impl::timeout_infinite);
91 event_impl(
const event_impl&);
92 event_impl
const & operator=(
const event_impl&);
104 _PPLXIMP ~critical_section_impl();
106 _PPLXIMP
void lock();
108 _PPLXIMP
void unlock();
112 typedef void * _PPLX_BUFFER;
115 _PPLX_BUFFER _M_impl[8];
117 critical_section_impl(
const critical_section_impl&);
118 critical_section_impl
const & operator=(
const critical_section_impl&);
121 #if _WIN32_WINNT >= _WIN32_WINNT_VISTA
129 class scoped_lock_read
132 explicit scoped_lock_read(
reader_writer_lock_impl &_Reader_writer_lock) : _M_reader_writer_lock(_Reader_writer_lock)
134 _M_reader_writer_lock.lock_read();
139 _M_reader_writer_lock.unlock();
143 reader_writer_lock_impl& _M_reader_writer_lock;
144 scoped_lock_read(
const scoped_lock_read&);
145 scoped_lock_read
const & operator=(
const scoped_lock_read&);
148 _PPLXIMP reader_writer_lock_impl();
150 _PPLXIMP
void lock();
152 _PPLXIMP
void lock_read();
154 _PPLXIMP
void unlock();
165 bool m_locked_exclusive;
167 #endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA
172 class recursive_lock_impl
176 recursive_lock_impl()
177 : _M_owner(-1), _M_recursionCount(0)
181 ~recursive_lock_impl()
183 _ASSERTE(_M_owner == -1);
184 _ASSERTE(_M_recursionCount == 0);
187 void recursive_lock_impl::lock()
189 auto id = ::pplx::details::platform::GetCurrentThreadId();
191 if ( _M_owner ==
id )
199 _M_recursionCount = 1;
203 void recursive_lock_impl::unlock()
205 _ASSERTE(_M_owner == ::pplx::details::platform::GetCurrentThreadId());
206 _ASSERTE(_M_recursionCount >= 1);
210 if ( _M_recursionCount == 0 )
219 long _M_recursionCount;
220 volatile long _M_owner;
226 _PPLXIMP
virtual void schedule(
TaskProc_t proc, _In_
void* param);
235 template<
class _Lock>
239 explicit scoped_lock(_Lock& _Critical_section) : _M_critical_section(_Critical_section)
241 _M_critical_section.lock();
246 _M_critical_section.unlock();
250 _Lock& _M_critical_section;
252 scoped_lock(
const scoped_lock&);
253 scoped_lock
const & operator=(
const scoped_lock&);
257 namespace extensibility
259 typedef ::pplx::details::event_impl event_t;
261 typedef ::pplx::details::critical_section_impl critical_section_t;
262 typedef scoped_lock<critical_section_t> scoped_critical_section_t;
264 #if _WIN32_WINNT >= _WIN32_WINNT_VISTA
265 typedef ::pplx::details::reader_writer_lock_impl reader_writer_lock_t;
266 typedef scoped_lock<reader_writer_lock_t> scoped_rw_lock_t;
267 typedef reader_writer_lock_t::scoped_lock_read scoped_read_lock_t;
268 #endif // _WIN32_WINNT >= _WIN32_WINNT_VISTA
271 typedef ::pplx::details::recursive_lock_impl recursive_lock_t;
272 typedef scoped_lock<recursive_lock_t> scoped_recursive_lock_t;
286 #ifndef _REPORT_PPLTASK_UNOBSERVED_EXCEPTION
287 #define _REPORT_PPLTASK_UNOBSERVED_EXCEPTION() do { \
291 #endif // _REPORT_PPLTASK_UNOBSERVED_EXCEPTION
void(_pplx_cdecl * TaskProc_t)(void *)
An elementary abstraction for a task, defined as void (__cdecl * TaskProc_t)(void *)...
Definition: pplxinterface.h:59
A generic RAII wrapper for locks that implements the critical_section interface cpprest_synchronizati...
Definition: pplxlinux.h:264
The pplx namespace provides classes and functions that give you access to the Concurrency Runtime...
Definition: pplx.h:81
struct __declspec(novtable) scheduler_interface
Scheduler Interface
Definition: pplxinterface.h:64
Definition: pplxwin.h:223
Mutex - lock for mutual exclusion
Definition: pplxwin.h:98
Reader writer lock
Definition: pplxlinux.h:140
details::linux_scheduler default_scheduler_t
Default scheduler type
Definition: pplxlinux.h:306