MEL
Microthread & Execution library
mel::core Namespace Reference

base functionalities More...

Classes

struct  use_functor_t
 
struct  use_function_t
 
class  Callback
 create Callback from callable More...
 
class  Callback< TRet, void >
 
struct  CSMultithreadPolicy
 
struct  CSNoMultithreadPolicy
 
class  CallbackSubscriptor_Base
 callback subscription functionalit More...
 
class  CallbackSubscriptorNotTyped
 
class  CallbackSubscriptorNotTyped< ThreadingPolicy, void >
 
class  CallbackSubscriptor
 
class  CallbackSubscriptor< ThreadingPolicy, void >
 
class  Event
 
class  FutureValue
 Wrapper for value holded by a Future. More...
 
class  Future_Common
 Common code for Futures that doesn't need to be templated. More...
 
class  Future
 Represents a value that maybe is not present at the current moment. More...
 
class  WaitException
 Exception class generated by WaitResult when wait for future gets an error. More...
 
class  WaitResult
 Wrapper for future value after wait. More...
 
struct  WaitErrorAsException
 Policy for treating error as exception in future wait functions. More...
 
struct  WaitErrorNoException
 Policy for not treating error as exception in future wait functions. More...
 
class  Singleton
 
class  Singleton_Multithread_Policy
 
class  Singleton_Singlethread_Policy
 
class  Thread
 Wrapper around std::thread to prive more abstractions. More...
 
class  Timer
 

Typedefs

typedef pthread_t ThreadId
 

Enumerations

enum  SubscriptionEmplacement { SE_BACK , SE_FRONT }
 
enum class  ECallbackResult : uint8_t { NO_UNSUBSCRIBE , UNSUBSCRIBE }
 Type resturned by callbacks subscribed to CallbackSubscriptors.
 
enum class  EWaitError : int { FUTURE_WAIT_OK = 0 , FUTURE_RECEIVED_KILL_SIGNAL , FUTURE_WAIT_TIMEOUT , FUTURE_UNKNOWN_ERROR = -3 }
 Generic result error codes for future waiting. More...
 
enum  EFutureState { NOTAVAILABLE , VALID , INVALID }
 
enum class  EThreadPriority {
  TP_LOWEST = 0x01 , TP_LOW = 0x02 , TP_NORMAL = 0x03 , TP_HIGH = 0x04 ,
  TP_HIGHEST , TP_NONE
}
 

Functions

template<class TRet , class T >
Callback< TRet, void > * makeEvent (T functor)
 
MEL_API unsigned int getNumProcessors ()
 Get the number of logical processors.
 
MEL_API uint64_t getProcessAffinity ()
 
MEL_API bool setAffinity (uint64_t)
 Set affinity for current thread.
 
template<class ErrorType = mel::core::WaitErrorAsException, class T >
::mel::core::WaitResult< T > waitForFutureThread (const mel::core::Future< T > &f, unsigned int msecs=::mel::core::Event::EVENT_WAIT_INFINITE) noexcept(std::is_same< ErrorType, ::mel::core::WaitErrorNoException >::value)
 Wait for a Future from a Thread.
 
MEL_API ::mel::core::Event::EWaitCode waitForBarrierThread (const ::mel::parallelism::Barrier &b, unsigned int msecs=Event::EVENT_WAIT_INFINITE)
 Wait for a barrier to activated in the context of a thread.
 
static ThreadId getCurrentThreadId ()
 

Variables

static const use_functor_t use_functor = use_functor_t()
 
static const use_function_t use_function = use_function_t()
 

Detailed Description

base functionalities

Enumeration Type Documentation

◆ EThreadPriority

Thread priority enumeration.

Enumerator
TP_LOWEST 

Lowest priority

TP_LOW 

Low priority

TP_NORMAL 

Normal/standard priority. This is the default priority new threads are assigned if none is specified

TP_HIGH 

High priority. Use with caution.

TP_HIGHEST 

Highest/realtime priority. May cause the system to become irresponsive while the thread is running.

◆ EWaitError

enum mel::core::EWaitError : int
strong

Generic result error codes for future waiting.

Enumerator
FUTURE_WAIT_OK 

No error.

FUTURE_RECEIVED_KILL_SIGNAL 

Wait for Future was interrupted because waiting Process was killed

FUTURE_WAIT_TIMEOUT 

Time out expired while waiting for Future.

FUTURE_UNKNOWN_ERROR 

Unknow error while waiting for Future.

Function Documentation

◆ getCurrentThreadId()

static ThreadId mel::core::getCurrentThreadId ( )
inlinestatic

get handle of the current executing thread