See Advanced Lua Bindings, section Calling Lua Code Asynchronously From C Code for how to use this class.
|
BA_API void | LThreadMgr_destructor (LThreadMgr *o) |
| This function terminates the Thread Pool and waits for all threads to become idle before returning.
|
|
BA_API void | LThreadMgr_constructor (LThreadMgr *o, HttpServer *server, ThreadPriority priority, int stackSize, int threads, lua_State *L, int allowCreate) |
| Initialize the Thread Pool. More...
|
|
BA_API ThreadJob * | ThreadJob_create (size_t size, ThreadJob_Run run) |
| Create a generic thread job. More...
|
|
BA_API ThreadJob * | ThreadJob_lcreate (size_t size, ThreadJob_LRun lrun) |
| Create a thread job designed to execute Lua code. More...
|
|
BA_API int | LThreadMgr_run (LThreadMgr *o, ThreadJob *tj) |
| This function sends a thread job to an available idle thread, or queues the job if no threads are currently available. More...
|
|
◆ LThreadMgr_canRun
#define LThreadMgr_canRun |
( |
|
o | ) |
! DoubleList_isEmpty(&(o)->idleThreadList) |
This function returns true if at least one thread is currently idle and there is no need to queue the job when calling LThreadMgr_run.
- Parameters
-
◆ LThreadMgr_enableHttpPool
#define LThreadMgr_enableHttpPool |
( |
|
o, |
|
|
|
server |
|
) |
| HttpServer_setThreadPoolIntf(server, (HttpCmdThreadPoolIntf*)o) |
◆ ThreadJob_LRun
ThreadJob callback designed for calling Lua code using pcall.
- Parameters
-
tj | the job passed into function LThreadMgr_run |
msgh | the index position to the BAS error handler function |
mgr | the manager associated with the global or dynamically created instance via ba.thread.create |
◆ ThreadJob_Run
Generic ThreadJob callback.
- Parameters
-
tj | the job passed into function LThreadMgr_run |
mgr | the manager associated with the global or dynamically created instance via ba.thread.create |
◆ LThreadMgr_constructor()
Initialize the Thread Pool.
- Parameters
-
o | |
server | |
priority | typically set to ThreadPrioNormal |
stackSize | typically set to BA_STACKSZ |
threads | Specify the initial number of threads to create |
L | the Lua state returned by balua_create |
allowCreate | set to TRUE to enable the two APIs ba.thread.create and ba.thread.configure |
◆ LThreadMgr_run()
This function sends a thread job to an available idle thread, or queues the job if no threads are currently available.
Before calling this method from outside of the server environment, you must have ownership of the SoDisp ThreadMutex.
◆ ThreadJob_create()
Create a generic thread job.
- Parameters
-
size | at least sizeof(ThreadJob) |
run | Your callback function will execute in the context of a thread within the Thread Manager |
◆ ThreadJob_lcreate()
Create a thread job designed to execute Lua code.
- Parameters
-
size | at least sizeof(ThreadJob) |
lrun | Your callback function will execute in the context of a thread within the Thread Manager |