Este conteúdo não está disponível no idioma selecionado.

7.2.5. Avoiding a Blocked Asynchronous Send


An asynchronous send call will place the message into the send buffer and return to execution immediately. However, if the send buffer is full the call will block until space is available.
If you need to ensure that an asynchronous send call does not block on a full buffer, you should query the buffer state before making the call. For example, in C++:
C++
  if (sender.getAvailable() > 0)
      sender.send(message, false)
   // else drop the message
Copy to Clipboard Toggle word wrap
Python
if sender.available() > 0:
  sender.send(message, sync=False)
else:
  # drop the message
Copy to Clipboard Toggle word wrap
You can also increase the size of the sender's replay buffer to reduce the chances of it filling up:
C++
sender.setCapacity(SOME_LARGE_NUMBER)
Copy to Clipboard Toggle word wrap
Python
sender.capacity = SOME_LARGE_NUMBER
Copy to Clipboard Toggle word wrap
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat