33#include <TargConfig.h>
150 DoubleList idleThreadList;
151 DoubleList runningThreadList;
152 DoubleList pendingJobList;
186#define LThreadMgr_canRun(o) ! DoubleList_isEmpty(&(o)->idleThreadList)
195#define LThreadMgr_enableHttpPool(o, server) \
196 HttpServer_setThreadPoolIntf(server, (HttpCmdThreadPoolIntf*)o)
221 int threads, lua_State* L,
int allowCreate);
266int lGetStdSockOptions(lua_State* L,
int tabIx,
const char** intf,
268#if BA_ENABLE_SHARKSSL
269void lsharkssl_unlock(lua_State *L,SharkSsl* super);
270SharkSsl* lsharkssl_lock(
271 lua_State *L,
int tabIx,SharkSsl_Role role,SharkSsl* lockedShark);
273int pushCertificate(lua_State *L,
SoDispCon* con);
274int pushCiphers(lua_State *L,
SoDispCon* con);
275int calcTabSize(lua_State* L,
int ix,
BaBool query);
277char* extractTab(
const char* tab, lua_State* L,
int ix,
280#define HTTPCLIENT "HTTPCLIENT"
282#define toHttpClient(L,ix) (struct HttpClient*)luaL_checkudata(L,ix,HTTPCLIENT)
284#define BACERTSTORE "BACERTSTORE"
287#define toCertStore(L,ix) (SharkSslCertStore*)luaL_checkudata(L,ix,BACERTSTORE)
BA_API void balua_relsocket(lua_State *L)
Notify registered coroutine sockets that the server is shutting down.
BA_API void balua_crypto(lua_State *L)
Install the crypto Lua bindings.
BA_API void balua_tracelogger(lua_State *L, struct LThreadMgr *tmgr)
Install the TraceLogger Lua bindings.
BA_API void balua_luaio(lua_State *L)
Install the LuaIo Lua bindings.
BA_API void balua_sharkssl(lua_State *L)
Install the SharkSSL Lua bindings.
BA_API void balua_socket(lua_State *L)
Install the socket Lua bindings.
BA_API void balua_http(lua_State *L)
Install the httpc Lua bindings.
BA_API void balua_forkpty(lua_State *L)
Install the forkpty Lua bindings.
ThreadPriority
Portable priority choices, mapped to the target operating system.
Definition: ThreadLib.h:61
BA_API ThreadJob * ThreadJob_lcreate(size_t size, ThreadJob_LRun lrun)
Create a thread job designed to execute Lua code.
void(* ThreadJob_Run)(struct ThreadJob *tj, struct LThreadMgr *mgr)
Generic ThreadJob callback.
Definition: lxrc.h:120
struct ThreadJob ThreadJob
An owned unit of work created by ThreadJob_create or ThreadJob_lcreate.
BA_API void LThreadMgr_constructor(LThreadMgr *o, HttpServer *server, ThreadPriority priority, int stackSize, int threads, lua_State *L, int allowCreate)
Initialize the thread pool and install ba.thread.
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 cur...
struct LThreadMgr LThreadMgr
Run native jobs and protected Lua callbacks on BAS worker threads.
BA_API void LThreadMgr_destructor(LThreadMgr *o)
This function terminates the Thread Pool and waits for all threads to stop before returning.
BA_API ThreadJob * ThreadJob_create(size_t size, ThreadJob_Run run)
Create a generic thread job.
void(* ThreadJob_LRun)(struct ThreadJob *tj, int msgh, struct LThreadMgr *mgr)
ThreadJob callback designed for calling Lua code using lua_pcall.
Definition: lxrc.h:132
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:121
A container for key/value pairs used when setting custom HTTP headers or URL encoded HTTP parameters.
Definition: HttpClient.h:90
Blocking HTTP/1.1 client with optional SharkSSL HTTPS support.
Definition: HttpClient.h:187
Worker-pool dispatch interface borrowed by HttpServer.
Definition: HttpCmdThreadPoolIntf.h:63
Route and process HTTP requests using a borrowed dispatcher.
Definition: HttpServer.h:3463
Run native jobs and protected Lua callbacks on BAS worker threads.
Definition: lxrc.h:148
lua_State * Lg
Global state.
Definition: lxrc.h:154
int runningThreads
Threads currently running.
Definition: lxrc.h:155
int pendingJobs
Jobs queued.
Definition: lxrc.h:156
HttpServer * server
The server object.
Definition: lxrc.h:153
int isDynamic
if created via ba.thread.create()
Definition: lxrc.h:157
int threads
number of threads
Definition: lxrc.h:160
Contains information about the physical socket connection.
Definition: SoDispCon.h:120
An owned unit of work created by ThreadJob_create or ThreadJob_lcreate.
Definition: lxrc.h:173
lua_State * Lt
Borrowed Lua thread, valid only during the job callback.
Definition: lxrc.h:177