This documenta- tion describes the current state of development.
Note that interfaces and functionality may still change.

Prokee Modules:
  A
  B
  C
  D
  E
  F
  G
  I
  L
  M
  N
  O
  P
  R
  S
  T
  U
  W

     open all    |    close all

GUI Elements:
  B
  C
  I
  M
  P
  R
  S
  T

     open all    |    close all

GUI Interactions:
  B
  F
  H
  S

     open all    |    close all

GUI Layouts:
  L

     open all    |    close all

Games/Demos:
  M

     open all    |    close all

Third Party Libraries:
  P
  F
  Z

     open all    |    close all

Information about this Website / Informationen zu dieser Webseite:
In case of any questions, or comments, please feel free to contact me via email at apoll500@gmail.com.

Module threadman [Version: v01] (Interface AbsThread)

   [AbsMsgItem]   [AbsThread]   [AbsThreadMan]

Contents

Inheritance:
AbsThread
Implementations: Thread

Constructors:
Thread (version 1)
AbsThread *createThread()
Thread (version 2)
AbsThread *createThread(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem))
Thread (version 3)
AbsThread *createThread(unsigned int tid,void(*main_func)(void *args),void *_args)
Thread (version 4)
AbsThread *createThread(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem),void(*main_func)(void *args),void *_args)

Methods:
startThread
int startThread()
iniFutex
void iniFutex()
freeFutex
void freeFutex()
print
void print()
mainloop
int mainloop()
feedback
int feedback()
sendMessage (version 1)
int sendMessage(AbsMsgItem *msg)
sendMessage (version 2)
int sendMessage(uint64_t msgID,uint64_t msgParam,uint64_t msgFlags,void *msgData)
getThreadID
unsigned int getThreadID()
getStatus
int getStatus()
setStatus
void setStatus(int st)
setCallback
void setCallback(int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem))
setThreadID
void setThreadID(unsigned int tid)
setManager
void setManager(AbsThreadMan *managerThread)
getManager
AbsThreadMan *getManager()
fwait
void fwait()
fpost
void fpost()

Constructors

   Thread (version 1)


This creates an empty Thread.

An "empty Thread" is a instance of Thread, which contains no thread, but my be used to provide methods of Thread to other threads (e.g. the main thread).

Constructor:
Thread()

Factory Method:
AbsThread *AbsThreadInterface::createThread()

Wrapper Class:
ThreadWrapper()

The static method AbsThreadInterface::createThread creates a new instance of class Thread.

Return value:
Returns an instance of Thread.

   Thread (version 2)


Thread wrapper class

Constructor:
Thread(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem))

Factory Method:
AbsThread *AbsThreadInterface::createThread(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem))

Wrapper Class:
ThreadWrapper(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem))

The static method AbsThreadInterface::createThread creates a new instance of class Thread.

Parameters:
Type Name Direction Description
unsigned int tidA unique ID of the thread.
int32_t(*callback)
(
   AbsThread *tread
,
   AbsMsgItem *msgItem
)
with typedef
TypeName
ThreadCallbackFunctioncallback
[IN] The thread-callback function.
Parameter
tread: Pointer to the thread wrapper class the message was sent to.
msgItem: Pointer to a message item.
Return value
Return value of the callback function.

Return value:
Returns an instance of Thread.

   Thread (version 3)


Thread wrapper class

Constructor:
Thread(unsigned int tid,void(*main_func)(void *args),void *_args)

Factory Method:
AbsThread *AbsThreadInterface::createThread(unsigned int tid,void(*main_func)(void *args),void *_args)

Wrapper Class:
ThreadWrapper(unsigned int tid,void(*main_func)(void *args),void *_args)

The static method AbsThreadInterface::createThread creates a new instance of class Thread.

Parameters:
Type Name Direction Description
unsigned int tidA unique ID of the thread.
void(*main_func)
(
   void *args
)
with typedef
TypeName
ThreadMainFunctionmain_func
[IN] The thread-main function.
Parameter
args: Pointer to the function arguments.
void *_argsPointer to arguments for the call of main_func.

Return value:
Returns an instance of Thread.

   Thread (version 4)


Thread wrapper class

Constructor:
Thread(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem),void(*main_func)(void *args),void *_args)

Factory Method:
AbsThread *AbsThreadInterface::createThread(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem),void(*main_func)(void *args),void *_args)

Wrapper Class:
ThreadWrapper(unsigned int tid,int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem),void(*main_func)(void *args),void *_args)

The static method AbsThreadInterface::createThread creates a new instance of class Thread.

Parameters:
Type Name Direction Description
unsigned int tidA unique ID of the thread.
int32_t(*callback)
(
   AbsThread *tread
,
   AbsMsgItem *msgItem
)
with typedef
TypeName
ThreadCallbackFunctioncallback
[IN] The thread-callback function.
Parameter
tread: Pointer to the thread wrapper class the message was sent to.
msgItem: Pointer to a message item.
Return value
Return value of the callback function.
void(*main_func)
(
   void *args
)
with typedef
TypeName
ThreadMainFunctionmain_func
[IN] The thread-main function.
Parameter
args: Pointer to the function arguments.
void *_argsPointer to arguments for the call of main_func.

Return value:
Returns an instance of Thread.


Methods

   startThread


Starts the thread

Signature:
int startThread()

Return value:
Returns 0 or error value.

   iniFutex


Initialization

This function must not be called from outside of the thread.

Do not call this function, except in case of an empty Thread.

Signature:
void iniFutex()

   freeFutex


Closes the Futex.

Signature:
void freeFutex()

   print


Printing debug info.

Signature:
void print()

   mainloop


The main-loop of the thread.

This function is called at construction of Thread, if a callback function has been set.

Do not call this function, except in case of an empty Thread.

Signature:
int mainloop()

Return value:
Returns 0.

   feedback


The feedback function of the thread.

This function may be called to provide feedback for interactive threads.

Do not call this function from outside of the thread.

Signature:
int feedback()

Return value:
Returns 0.

   sendMessage (version 1)


Sends message to the thread.

Signature:
int sendMessage(AbsMsgItem *msg)

Parameters:
Type Name Direction Description
AbsMsgItem *msg[IN]Pointer to a AbsMsgItem object.


Return value:
Returns 0.

   sendMessage (version 2)


Sends message to the thread.

Signature:
int sendMessage(uint64_t msgID,uint64_t msgParam,uint64_t msgFlags,void *msgData)

Parameters:
Type Name Direction Description
uint64_t msgIDThe ID of the type of message.
uint64_t msgParamThe Parameter of message.
uint64_t msgFlagsThe Flags of message.
void *msgDataThe data sent with the message.


Return value:
Returns 0.

   getThreadID


Returns the ID of the thread.

Signature:
unsigned int getThreadID()

Return value:
The ID of the thread.

   getStatus


Returns the status of the thread.

Signature:
int getStatus()

Return value:
The status of the thread.

   setStatus


Sets the status of the thread.

Signature:
void setStatus(int st)

Parameters:
Type Name Direction Description
int stThe status of the thread.


   setCallback


Sets the callback function of the thread.

This function may be useful for setting up empty Threads.

Signature:
void setCallback(int32_t(*callback)(AbsThread *tread,AbsMsgItem *msgItem))

Parameters:
Type Name Direction Description
int32_t(*callback)
(
   AbsThread *tread
,
   AbsMsgItem *msgItem
)
with typedef
TypeName
ThreadCallbackFunctioncallback
[IN] The thread-callback function.
Parameter
tread: Pointer to the thread wrapper class the message was sent to.
msgItem: Pointer to a message item.
Return value
Return value of the callback function.


   setThreadID


Sets the ID of the thread.

This function may be useful for setting up empty Threads.

Signature:
void setThreadID(unsigned int tid)

Parameters:
Type Name Direction Description
unsigned int tidA unique ID of the thread.


   setManager


Sets the pointer to the thread manager.

Signature:
void setManager(AbsThreadMan *managerThread)

Parameters:
Type Name Direction Description
AbsThreadMan *managerThread[IN]Pointer to the thread manager (a AbsThreadMan object).


   getManager


Returns a pointer to the thread manager.

Signature:
AbsThreadMan *getManager()

Return value:
A pointer to the thread manager, or NULL, if not set.

   fwait


Pauses the calling thread.

This function should only be called from the thread managed by this Thread object.

If you want to pause a thread from an other thread, send a pause message instead.

Signature:
void fwait()

   fpost


Wakes up a paused thread.

Any other thread may call this function to wake up this thread.

Signature:
void fpost()


Copyright © 2017 - 2019 by Andreas Pollhammer