Commit Graph

9 Commits

Author SHA1 Message Date
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 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 c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski 8d7e0b5629 Time-travelling license text 2013-06-22 03:14:15 -03:00
Alex Szpakowski 4c616e409b Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602) 2013-05-03 04:04:44 -03:00
Bart van Strien c7c5d0ed6b Fix race conditions and deadlocks in Channels (hopefully) (issue #554)
Also, this is a giant commit because of the official Code Style (tm) was applied.

--HG--
branch : minor
2013-01-30 17:15:12 +01:00
Bart van Strien be2363fc00 Add Channel:supply(), a blocking version of Channel:push()
--HG--
branch : minor
2013-01-27 20:04:16 +01:00
Bart van Strien 399a6a6614 Merge in channels from love-experiments
Rewritten love.thread and changed communication
method from weird system before, to channels.

--HG--
branch : minor
2012-07-04 17:15:16 +02:00