Commit Graph

32 Commits

Author SHA1 Message Date
bjorn 1aef9963f5 Clean up thread module; 2019-05-14 04:43:38 -07:00
bjorn 594921d2ec newThread: can load thread code from a file or Blob;
Also fix a lifetime issue: If the string containing thread code was
garbage collected before you started the thread, you would have been
running free'd memory as Lua code!
2019-05-02 15:09:54 -07:00
bjorn 011db5f1e5 Revert "Free objects in their destructors;"
This reverts commit d31dca5520.

We can't unconditionally free because sometimes objects are temporarily
allocated on the stack.
2019-04-05 05:45:05 -07:00
bjorn 0b62960472 Use lovrVariantDestroy in lovrChannelClear; 2019-04-05 05:15:17 -07:00
bjorn c20c94b3e1 thread: forward declarations; 2019-04-05 05:11:49 -07:00
bjorn 66b7288764 event: forward declarations; 2019-04-05 04:32:58 -07:00
bjorn d31dca5520 Free objects in their destructors; 2019-04-05 03:56:10 -07:00
bjorn 6fdeda9e61 Make lovrRelease non-generic;
We know what type we're releasing 99% of the time, we don't need to
play a guessing game in lovrRelease, just have the caller say which
destructor to use.

There is lovrGenericRelease for situations where we need it, which
does the slower lookup of the destructor.
2019-04-05 03:41:03 -07:00
bjorn e05b835927 Fix prototypes; 2019-02-17 14:39:51 -08:00
bjorn 6fd4b9ef4c Header cleanup; 2019-01-24 17:43:25 -08:00
bjorn cb9f166234 Revert "Replace sprintf with stb version;"
This reverts commit 8f9d24c51f.
2019-01-24 17:39:27 -08:00
bjorn 8f9d24c51f Replace sprintf with stb version; 2019-01-18 08:55:29 -08:00
bjorn 086f7f4e47 lovrRelease frees objects instead of destructor;
That way objects allocated on the stack can be destroyed.
2018-12-19 01:41:01 -08:00
bjorn 9803e9916f Use naming convention for destructor; 2018-12-19 01:04:42 -08:00
bjorn 155a0c1449 lovr*Create -> lovr*Init; lovr*Create macro; 2018-12-19 01:04:42 -08:00
bjorn 60a12a6b7e Rename thread module init/destroy; 2018-12-19 01:04:42 -08:00
bjorn 0e99d47394 Fix module destruction;
There is a problem when a Thread stops: it destroys all of the modules
that it required.  This is because we unconditionally call luax_atexit
when modules are required, and when the thread lua_State dies it takes
all of the modules with it.  To fix this, lovr<Module>Init will return
whether or not initialization successfully happened, which provides us
with enough info to know if we should place the luax_atexit destructor
2018-11-19 09:24:28 -08:00
bjorn 9e494cae46 Make custom events work; 2018-07-26 19:38:01 -07:00
bjorn 0b922a9703 rm Variant type name tracking; 2018-07-24 21:21:37 -07:00
bjorn bc2d638b00 Refs know their type; 2018-07-24 19:14:29 -07:00
bjorn 57c8dfe146 Clean up includes; 2018-07-04 13:51:35 -07:00
bjorn fe47104869 More memory stuff; 2018-03-24 01:17:36 -07:00
bjorn d2e0642b59 Use calloc in lovrAlloc; 2018-03-21 12:56:16 -07:00
bjorn 4df836727c Simplify refcounting; 2018-02-26 00:59:03 -08:00
bjorn f54d1c1e03 rm containerof; 2018-02-25 23:19:39 -08:00
bjorn f5fa9a4e5c Make modules more restartable;
Except headset.  Screw you, headset.
2018-02-23 18:38:53 -08:00
bjorn 9d42d7737a Finish Channel API; 2018-02-23 18:38:53 -08:00
bjorn c92604859a Start Channel; 2018-02-23 18:38:53 -08:00
bjorn 583afc9f16 Reorganize main/lovr separation; 2018-02-23 18:38:34 -08:00
bjorn 109b40bcb4 Thread:wait; Thread:getError; Thread:isRunning; 2018-02-23 18:38:34 -08:00
bjorn 5c9f234075 Basic working threads; 2018-02-23 18:38:34 -08:00
bjorn f010a0ffc2 Basic module setup; 2018-02-23 18:38:33 -08:00