Skip to main content
9 votes
Accepted

A TCP server which uses one thread to read while writing data with another thread

It's perfectly ok to read and write a socket from two threads at the same time. You don't need to mutex anything, just have one thread read and one thread write. But if the point of the program was ...
Guntram Blohm's user avatar
7 votes

A TCP server which uses one thread to read while writing data with another thread

fcntl() can fail: According to the Linux man page: On error, -1 is returned, and errno is set to indicate the error. You're ...
Harith's user avatar
  • 9,462
6 votes

"Polite" internet connectivity check on separate thread

Why 3 threading.Condition instances? You have defined 3 threading.Condition instances when I believe you could have simplified ...
Booboo's user avatar
  • 1,756
3 votes

A thread-safe performant Money Transfer API in Java

This is not code where you should be remotely worried about the performance. Maximize readability until you have a tested, proven bottleneck. What happens when an external thread acquires and does not ...
Eric Stein's user avatar
  • 6,562
3 votes
Accepted

"Polite" internet connectivity check on separate thread

There are some difficulties with the OP code. The two aspects are: design of service implementation of a given design design abuse of the digital commons This is just not good. It discourages ...
J_H's user avatar
  • 30.8k

Only top scored, non community-wiki answers of a minimum length are eligible