File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed 
Sources/AWSLambdaRuntimeCore Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 1414
1515import  Foundation
1616import  Logging
17- import  NIOConcurrencyHelpers
1817import  NIOCore
18+ import  Synchronization
1919
20- // We need `@unchecked` Sendable here, as `NIOLockedValueBox` does not understand `sending` today.
21- // We don't want to use `NIOLockedValueBox` here anyway. We would love to use Mutex here, but this
22- // sadly crashes the compiler today.
23- public  final  class  LambdaRuntime < Handler> :  @unchecked   Sendable  where  Handler:  StreamingLambdaHandler  { 
24-     // TODO: We want to change this to Mutex as soon as this doesn't crash the Swift compiler on Linux anymore
25-     let  handlerMutex :  NIOLockedValueBox < Handler ? > 
20+ public  final  class  LambdaRuntime < Handler> :  Sendable  where  Handler:  StreamingLambdaHandler  { 
21+     let  handlerMutex :  Mutex < Handler ? > 
2622    let  logger :  Logger 
2723    let  eventLoop :  EventLoop 
2824
@@ -31,7 +27,7 @@ public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: St
3127        eventLoop:  EventLoop  =  Lambda . defaultEventLoop, 
3228        logger:  Logger  =  Logger ( label:  " LambdaRuntime " ) 
3329    )  { 
34-         self . handlerMutex =  NIOLockedValueBox ( handler) 
30+         self . handlerMutex =  Mutex ( handler) 
3531        self . eventLoop =  eventLoop
3632        self . logger =  logger
3733    } 
@@ -45,7 +41,7 @@ public final class LambdaRuntime<Handler>: @unchecked Sendable where Handler: St
4541        let  ip  =  String ( ipAndPort [ 0 ] ) 
4642        guard  let  port =  Int ( ipAndPort [ 1 ] )  else  {  throw  LambdaRuntimeError ( code:  . invalidPort)  } 
4743
48-         let  handler  =  self . handlerMutex. withLockedValue  {  handler in 
44+         let  handler  =  self . handlerMutex. withLock  {  handler in 
4945            let  result  =  handler
5046            handler =  nil 
5147            return  result
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments