github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/actor/unbounded_lock_free.go (about)

     1  package actor
     2  
     3  import (
     4  	"github.com/asynkron/protoactor-go/internal/queue/mpsc"
     5  )
     6  
     7  // UnboundedLockfree returns a producer which creates an unbounded, lock-free mailbox.
     8  // This mailbox is cheaper to allocate, but has a slower throughput than the plain Unbounded mailbox.
     9  func UnboundedLockfree(mailboxStats ...MailboxMiddleware) MailboxProducer {
    10  	return func() Mailbox {
    11  		return &defaultMailbox{
    12  			userMailbox:   mpsc.New(),
    13  			systemMailbox: mpsc.New(),
    14  			middlewares:   mailboxStats,
    15  		}
    16  	}
    17  }