Home » U++ Library support » U++ Core » SIGPIPE problem
Re: SIGPIPE problem [message #57154 is a reply to message #57152] |
Tue, 01 June 2021 13:15 |
Oblivion
Messages: 1093 Registered: August 2007
|
Senior Contributor |
|
|
Well, the SIGPIPE issue is a relic network/socket programmers have to deal with, dating back to the implementation of TCP sockets in unix in early 80s.
AFAIK, there is no perfect solution. While the posix manual seems to define MSG_NOSIGNAL from some point on, it is not adopted by every camp yet.
Another workaround seems to be this, which I didn't know either:
Quote:
The most general solution, for when you are not in full control of the program's signal handling and want to write data to an actual pipe or use write(2) on a socket, is to first mask the signal for the current thread with pthread_sigmask(3), write the data, drain any pending signal with sigtimedwait(2) and a zero timeout, and then finally unmask SIGPIPE. This technique is described in more detail here. Note that some systems such as OpenBSD do not have sigtimedwait(2) in which case you need to use sigpending(2) to check for pending signals and then call the blocking sigwait(2).
Read the full blog, here:
https://www.doof.me.uk/2020/09/23/sigpipe-and-how-to-ignore- it/
Workaround (explained):
https://web.archive.org/web/20200126153413/http://www.microh owto.info:80/howto/ignore_sigpipe_without_affecting_other_th reads_in_a_process.html
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Tue, 01 June 2021 13:23] Report message to a moderator
|
|
|
|
|
SIGPIPE problem
By: zsolt on Wed, 26 May 2021 05:19
|
|
|
Re: SIGPIPE problem
By: mirek on Thu, 27 May 2021 09:14
|
|
|
Re: SIGPIPE problem
By: zsolt on Thu, 27 May 2021 16:41
|
|
|
Re: SIGPIPE problem
By: Novo on Fri, 28 May 2021 20:41
|
|
|
Re: SIGPIPE problem
By: mirek on Mon, 31 May 2021 09:44
|
|
|
Re: SIGPIPE problem
By: zsolt on Mon, 31 May 2021 11:01
|
|
|
Re: SIGPIPE problem
By: mirek on Mon, 31 May 2021 11:21
|
|
|
Re: SIGPIPE problem
|
|
|
Re: SIGPIPE problem
By: zsolt on Mon, 31 May 2021 17:05
|
|
|
Re: SIGPIPE problem
By: zsolt on Mon, 31 May 2021 17:06
|
|
|
Re: SIGPIPE problem
By: zsolt on Mon, 31 May 2021 17:10
|
|
|
Re: SIGPIPE problem
By: Novo on Mon, 31 May 2021 17:18
|
|
|
Re: SIGPIPE problem
|
|
|
Re: SIGPIPE problem
By: mirek on Tue, 01 June 2021 09:19
|
|
|
Re: SIGPIPE problem
|
Goto Forum:
Current Time: Thu May 09 14:34:35 CEST 2024
Total time taken to generate the page: 0.01576 seconds
|