Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
Coroutine assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Nov 20, 2018
1 parent e9d4339 commit cc03cb4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/ReplicatedStorage/Aero/Shared/Event.modulescript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ local CO_RUNNING = coroutine.running
local CO_YIELD = coroutine.yield
local CO_RESUME = coroutine.resume
local BLANK_FUNC = function() end
local ASSERT = assert


local Event = {}
Expand Down Expand Up @@ -80,7 +81,7 @@ function Event:Wait()
local connection
connection = self:Connect(function(...)
connection:Disconnect()
CO_RESUME(thread, ...)
ASSERT(CO_RESUME(thread, ...))
end)
return CO_YIELD()
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function Cache:FlushAllConcurrent()
self:Flush(key, true)
numFlushed = (numFlushed + 1)
if (numFlushed == numData) then
coroutine.resume(thread)
assert(coroutine.resume(thread))
end
end)
end
Expand Down
4 changes: 2 additions & 2 deletions src/ServerStorage/Aero/Services/DataService.modulescript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function DataService:FlushAllConcurrent()
local function IncFlushed()
numFlushed = (numFlushed + 1)
if (numFlushed == numCaches) then
coroutine.resume(thread)
assert(coroutine.resume(thread))
end
end
for player,cache in pairs(playerCaches) do
Expand Down Expand Up @@ -280,7 +280,7 @@ function DataService:Start()
pcall(func)
numCompleted = (numCompleted + 1)
if (numCompleted == numBinded) then
coroutine.resume(thread)
assert(coroutine.resume(thread))
end
end)()
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function Fade:FromTo(fromTransparency, toTransparency, duration, async)
end

if (async) then
coroutine.resume(coroutine.create(AwaitEnd))
coroutine.wrap(AwaitEnd)()
else
AwaitEnd()
end
Expand Down

0 comments on commit cc03cb4

Please sign in to comment.