Bart van Strien
e80247c191
Happy new year! ✨
2018-01-03 19:47:35 +01:00
Alex Szpakowski
b838d0de54
Simplified an internal Variant constructor to be more intuitive to use.
...
--HG--
branch : minor
2017-09-30 10:39:24 -03:00
Bart van Strien
09c1259857
Add optional timeout values to Channel:supply and Channel:demand ( resolves #1344 )
...
--HG--
branch : minor
2017-09-11 13:40:21 +02:00
Bart van Strien
5ddc89a033
Added cycle detection to Variant
...
We accidentally enabled nested tables previously, and now it errors properly when the tables contain cycles. Before you'd get (or at least I got) a nice lua stack overflow error.
--HG--
branch : minor
2017-08-30 13:07:57 +02:00
Alex Szpakowski
74d9bc7faf
Add traceback information to the error string generated if a thread causes a Lua error.
...
--HG--
branch : minor
2017-08-07 20:15:26 -03:00
Bart van Strien
a4a62f390a
Disable signal handling in threads (see issue #1042 )
...
I don't necessarily like having to do these extra calls whenever threads are
spawned (and what happens to signals during the time signal delivery is
disabled?) but it seems to fully fix os.execute.
NOTE: Also disables signals when loading openal, as it or one of its backends
spawns threads internally, and does not disable signals itself.
--HG--
branch : minor
2017-07-02 15:27:58 +02:00
Bart van Strien
03b863d788
Simplify love.audio's Pool class
...
Move most logic back to Source. Pool now simply contains a list of playing
sources and a mutex. Also gets rid of the pause/pauseAtomic duplication in
Source, since it can now request a lock from Pool itself.
--HG--
branch : minor
2017-02-11 21:41:22 +01:00
Alex Szpakowski
abb72cb813
Happy new year! 🥂
...
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Bart van Strien
9f6aa716fa
Pass Type to luax_register_type by pointer instead of reference
...
Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference.
<Textmode> the best kind of behavior
--HG--
branch : dynamiccore2
2016-11-14 21:51:47 +01:00
Bart van Strien
d967a755e5
Make love::Type handle type names
...
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type
--HG--
branch : dynamiccore2
2016-11-14 21:06:53 +01:00
Bart van Strien
5d43c9601a
Automatically deduce the type in luax_pushtype, if possible
...
--HG--
branch : dynamiccore2
2016-11-13 17:38:42 +01:00
Bart van Strien
7dd960619d
Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
...
--HG--
branch : dynamiccore2
2016-11-13 17:13:40 +01:00
Bart van Strien
c761202486
Build type information on first use (load-time), instead of using a hardcoded list
...
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski
15ba27f417
Merge default into minor
...
--HG--
branch : minor
2016-10-08 11:03:37 -03:00
Alex Szpakowski
b1b4a637b5
Fix a potential crash when a Thread ends (resolves issue #1219 ).
2016-10-08 10:50:50 -03:00
Alex Szpakowski
54efa825c3
Merge default into minor
...
--HG--
branch : minor
2016-09-11 13:09:01 -03:00
Alex Szpakowski
0b1bfba493
Use SDL_DetachThread instead of a conditional SDL_WaitThread when a Thread is destroyed.
2016-09-08 23:33:48 -03:00
Alex Szpakowski
293bc79b97
Merge default into minor
...
--HG--
branch : minor
2016-03-12 22:04:07 -04:00
Alex Szpakowski
d0c0240e09
Very minor channel / variant performance improvements and cleanup.
2016-03-12 19:11:03 -04:00
Alex Szpakowski
140faf0cae
Channel:push now returns an id value. Added Channel:hasRead(id), which returns true if the value that the id represents has already been popped, demanded, or cleared from the Channel. Resolves issue #1104 .
...
--HG--
branch : minor
2016-03-09 22:04:14 -04:00
Alex Szpakowski
a0bbcce8ee
The video decoding thread efficiently waits for a video to be created before doing anything, rather than sleeping for 2ms in a loop. Reduces the CPU usage of the video worker thread to ~0% when no videos are loaded.
2016-03-05 21:56:51 -04:00
Alex Szpakowski
f51bbb8462
Cleaned up some StrongRef-related code.
2016-03-01 18:57:17 -04:00
Alex Szpakowski
e08374fdd1
We don't need a mutex lock in Channel::retain/release... I think.
2016-02-26 18:38:39 -04:00
Alex Szpakowski
23fcaec89f
The Variant class is now meant to be used on the stack instead of allocated on the heap. As a result (and because of related changes), performance of Channels has roughly doubled when pushing and popping most types.
2016-02-14 16:39:32 -04:00
Alex Szpakowski
46a2e7b85c
Happy new year! 🎉
2016-01-01 00:05:06 -04:00
Alex Szpakowski
2c4e713114
Imported some of the dynamiccore branch from love-experiments:
...
- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.
- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.
Also removed most of the header declarations for wrapper functions.
2015-11-29 20:38:12 -04:00
Alex Szpakowski
66942d5f31
Added the ability to use custom mipmaps in Images, via love.graphics.newImage(filename, {mipmap1, mipmap2, ...}). Resolves issue #1064 .
...
All mipmap levels must be present if custom mipmaps are used (and their sizes must be half the size of the previous mipmap level, rounded down.)
Image:getData now returns all custom mipmaps in an Image.
2015-07-30 20:48:36 -03:00
Bart van Strien
7e44034757
Add a MutexRef class to clean up Mutex handling code
2015-07-06 11:58:08 +02:00
Alex Szpakowski
eee1fbac79
love.filesystem is now loaded by default in threads (see issue #1040.)
2015-05-01 21:20:23 -03:00
Alex Szpakowski
8e42f591ce
Updated the iOS xcode project search paths for the luajit headers and static library.
2015-04-25 12:00:07 -03:00
Alex Szpakowski
289eeb4fe0
Added Channel:performAtomic(func, ...). Resolves issue #1034 .
...
performAtomic calls the function and passes the Channel as the first argument, plus any additional specified arguments. The called function should do as little work as possible.
To other threads, all methods for that Channel are executed in a single step inside the function. This can prevent a large number of potiential race conditions.
Example:
-- main.lua:
local function set(channel, value)
channel:clear()
channel:push(value)
return "set value"
end
assert(channel:performAtomic(set, 1) == "set value")
-- thread.lua
while true do
assert(channel:peek() == 1)
end
2015-04-24 23:53:28 -03:00
Alex Szpakowski
2f419c1c83
Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
...
--HG--
branch : minor
2015-03-01 18:32:41 -04:00
Alex Szpakowski
33d20620b5
The Proxy struct now stores an actual love::Object pointer (rather than void*), which makes code using Proxies a bit cleaner.
...
--HG--
branch : minor
2015-02-21 20:52:29 -04:00
Alex Szpakowski
ebc68023a7
Fix many warnings about implicit integer conversions when compiling for 64 bits.
...
--HG--
branch : minor
2015-02-20 01:20:08 -04:00
Alex Szpakowski
c106d9ff53
love.event can now handle any number of event arguments.
...
--HG--
branch : minor
2015-02-15 21:31:22 -04:00
Alex Szpakowski
cf60cf89fc
De-namespaced a class, to make it less verbose.
2015-01-24 04:09:56 -04:00
Alex Szpakowski
c7b45b3505
Updated copyright for the new year
2014-12-31 19:32:43 -04:00
Alex Szpakowski
a7b27f3303
Forgot to remove a bit of code...
2014-12-11 21:23:06 -04:00
Alex Szpakowski
6eee2368be
Literal strings containing Lua code can be passed into love.thread.newThread directly, similar to loadstring and love.graphics.newShader (resolves issue #622.)
...
Threads are still *very* heavyweight objects and should be treated as such, unlike the functions returned by loadstring.
2014-12-11 21:22:12 -04:00
Alex Szpakowski
da7cd267ea
Changed luax_pushtype to retain the pushed object itself, but only if the object isn't in the Lua state already.
...
Previously, calling e.g. love.graphics.getFont() 10,000 times would retain the object 10,000 times (and release it 10,000 times when the Font object was garbage-collected in the Lua state.) Now it will only retain it once and release it once.
2014-08-09 16:04:59 -03:00
Alex Szpakowski
d59c76a55f
Reduced the number of explicit retain/release method calls on love objects. Less chance of bugs!
2014-08-07 14:53:17 -03:00
Alex Szpakowski
d52bab4221
Updated the new module changes to use more compile/link-time checking rather than runtime checking.
2014-07-21 15:12:01 -03:00
Alex Szpakowski
014b9a46e5
Updated the Lua wrapper code for modules to account for cases where the module's instance is removed from memory completely and recreated during the program's lifetime.
2014-07-21 14:52:01 -03:00
Alex Szpakowski
dfa319e01a
Replaced the EXCEPT_GUARD macro for converting love exceptions into Lua errors with the new luax_catchexcept function, which takes lambda function arguments.
2014-06-03 19:27:00 -03:00
Alex Szpakowski
1bc8b7346d
Added internal thread name support, for use with debuggers.
2014-05-02 08:56:23 -03:00
Alex Szpakowski
e4dc533bb2
Minor code cleanup
2014-05-01 14:12:21 -03:00
Alex Szpakowski
3120a0e650
Goodbye 2013, hello 2014!
2014-01-03 17:28:58 -04:00
Alex Szpakowski
74f26160da
Fixed a couple bugs caught by clang's static analyzer
2013-09-18 18:30:12 -03:00
Alex Szpakowski
06f80d5c08
Fixed undefined behaviour when love exceptions are converted into Lua errors (resolves issue #729 )
2013-09-05 23:17:29 -03:00
Alex Szpakowski
d3826aba9d
Improved thread safety of love.event.wait and love.event.push
2013-08-30 17:34:58 -03:00