vSMC
vSMC: Scalable Monte Carlo
Classes | Public Member Functions | Protected Member Functions | List of all members
vsmc::DispatchSourceBase< Type > Class Template Reference

Base class of DispatchSource. More...

#include <vsmc/gcd/dispatch_source.hpp>

Public Member Functions

void cancel () const
 
unsigned long get_data () const
 
uintptr_t get_handle () const
 
unsigned long get_mask () const
 
void resume () const
 
void set_cancel_handler (::dispatch_block_t cancel_handler) const
 
void set_cancel_handler_f (::dispatch_function_t cancel_handler) const
 
void set_event_handler (::dispatch_block_t event_handler) const
 
void set_event_handler_f (::dispatch_function_t event_handler) const
 
void set_registration_handler (::dispatch_block_t registration_handler) const
 
void set_registration_handler_f (::dispatch_function_t registration_handler) const
 
void suspend () const
 
long testcancel () const
 
- Public Member Functions inherited from vsmc::DispatchObject< ::dispatch_source_t >
 DispatchObject (const ::dispatch_source_t &object, bool retained)
 Create a DispatchObject from its C-type object. More...
 
 DispatchObject (const DispatchObject< ::dispatch_source_t > &other)
 
 DispatchObject (DispatchObject< ::dispatch_source_t > &&other)
 
 ~DispatchObject ()
 
void * get_context () const
 
::dispatch_source_t object () const
 Return the underlying Dispatch object. More...
 
void object (::dispatch_source_tobj)
 Set the underlying Dispatch object and retain it. More...
 
DispatchObject< ::dispatch_source_t > & operator= (const DispatchObject< ::dispatch_source_t > &other)
 
DispatchObject< ::dispatch_source_t > & operator= (DispatchObject< ::dispatch_source_t > &&other)
 
void set_context (void *context) const
 
void set_finalizer_f (::dispatch_function_t finalizer) const
 

Protected Member Functions

 DispatchSourceBase (uintptr_t handle, unsigned long mask,::dispatch_queue_t queue)
 

Detailed Description

template<DispatchSourceType Type>
class vsmc::DispatchSourceBase< Type >

Base class of DispatchSource.

Bug:
A DispachSource object is manually retained when created. It is supposed to be retained by dispatch_source_create according to the documents. But this seems not to be the case in the current implementation (Mac OS X 10.9). The worst case is that a source object is retained one more time than it is released. A simple test example is,
::dispatch_source_t source = ::dispatch_source_create( /* arguments */ );
::dispatch_release(source); // generate error

Definition at line 71 of file dispatch_source.hpp.

Constructor & Destructor Documentation

template<DispatchSourceType Type>
vsmc::DispatchSourceBase< Type >::DispatchSourceBase ( uintptr_t  handle,
unsigned long  mask,
::dispatch_queue_t  queue 
)
inlineprotected

Definition at line 131 of file dispatch_source.hpp.

Member Function Documentation

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::cancel ( ) const
inline

Definition at line 79 of file dispatch_source.hpp.

template<DispatchSourceType Type>
unsigned long vsmc::DispatchSourceBase< Type >::get_data ( ) const
inline

Definition at line 84 of file dispatch_source.hpp.

template<DispatchSourceType Type>
uintptr_t vsmc::DispatchSourceBase< Type >::get_handle ( ) const
inline

Definition at line 87 of file dispatch_source.hpp.

template<DispatchSourceType Type>
unsigned long vsmc::DispatchSourceBase< Type >::get_mask ( ) const
inline

Definition at line 90 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::resume ( ) const
inline

Definition at line 75 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::set_cancel_handler ( ::dispatch_block_t  cancel_handler) const
inline

Definition at line 109 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::set_cancel_handler_f ( ::dispatch_function_t  cancel_handler) const
inline

Definition at line 93 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::set_event_handler ( ::dispatch_block_t  event_handler) const
inline

Definition at line 112 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::set_event_handler_f ( ::dispatch_function_t  event_handler) const
inline

Definition at line 96 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::set_registration_handler ( ::dispatch_block_t  registration_handler) const
inline

Definition at line 116 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::set_registration_handler_f ( ::dispatch_function_t  registration_handler) const
inline

Definition at line 100 of file dispatch_source.hpp.

template<DispatchSourceType Type>
void vsmc::DispatchSourceBase< Type >::suspend ( ) const
inline

Definition at line 77 of file dispatch_source.hpp.

template<DispatchSourceType Type>
long vsmc::DispatchSourceBase< Type >::testcancel ( ) const
inline

Definition at line 81 of file dispatch_source.hpp.