Skip to content

Commit

Permalink
Nospecialize close(c::Channel, excp::Exception) on excp.
Browse files Browse the repository at this point in the history
Fixes #49507.

Avoids dynamic dispatch when closing a Channel with an Exception, and
should avoid a call into the runtime for julia compilation when
attempting to report an exception.
  • Loading branch information
NHDaly committed Apr 26, 2023
1 parent b12ddca commit 36ace54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/channels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Close a channel. An exception (optionally given by `excp`), is thrown by:
* [`put!`](@ref) on a closed channel.
* [`take!`](@ref) and [`fetch`](@ref) on an empty, closed channel.
"""
function close(c::Channel, excp::Exception=closed_exception())
function close(c::Channel, @nospecialize(excp::Exception=closed_exception()))
lock(c)
try
c.excp = excp
Expand Down

0 comments on commit 36ace54

Please sign in to comment.