|
Open Model Railroad Network (OpenMRN)
|
Utility class to help running a "pthread"-like thread in the main executor. More...
#include <test_main.hxx>
Public Types | |
| typedef void * | thread_fn_t(void *) |
| Function type for a thread's main entry point. | |
Public Member Functions | |
| ExecuteOnMainExecutor (thread_fn_t *fn, void *arg) | |
| Schedules the function fn with argument arg on the main executor. | |
| void | run () OVERRIDE |
| Runs the intended function with the given argument and then deletes this when done. | |
Public Member Functions inherited from Executable | |
| void | test_deletion () |
| void | notify () override |
| Crashes the program – everyone who is expecting notify calls must override this function. | |
| virtual void | alloc_result (QMember *item) |
| Return the result of an alloc_async() from a memory Pool. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Private Attributes | |
| thread_fn_t * | fn_ |
| pointer to function to run. | |
| void * | arg_ |
| argument to pass to function. | |
Additional Inherited Members | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Utility class to help running a "pthread"-like thread in the main executor.
Helpful for emscripten compatibility.
Definition at line 145 of file test_main.hxx.
| typedef void * ExecuteOnMainExecutor::thread_fn_t(void *) |
Function type for a thread's main entry point.
Definition at line 148 of file test_main.hxx.
|
inline |
Schedules the function fn with argument arg on the main executor.
Takes ownership of *this.
| fn | is the entry function of the "thread". |
| arg | is the argument to pass to the function. |
Definition at line 152 of file test_main.hxx.
|
inlinevirtual |
Runs the intended function with the given argument and then deletes this when done.
Implements Executable.
Definition at line 159 of file test_main.hxx.
|
private |
argument to pass to function.
Definition at line 165 of file test_main.hxx.
|
private |
pointer to function to run.
Definition at line 164 of file test_main.hxx.