diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-07 08:34:26 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-07 08:34:26 +0000 |
commit | fe2183abb895e30f2a10d6dbfbde96eaa6a9b313 (patch) | |
tree | 1aa77f5803fa9028e55603c7ef1f304070907202 /main/utils.c | |
parent | 8c4e2fcf35e1a80e850bb8cfb00ba50d266904d4 (diff) |
explain why ast_carefulwrite is written the way it is,
and also that it doesn't really work as claimed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47242 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/utils.c')
-rw-r--r-- | main/utils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c index 5c08f1372..f930f74c6 100644 --- a/main/utils.c +++ b/main/utils.c @@ -604,6 +604,21 @@ int ast_wait_for_input(int fd, int ms) return poll(pfd, 1, ms); } +/*! + * Try to write string, but wait no more than ms milliseconds before timing out. + * + * \note The code assumes that the file descriptor has NONBLOCK set, + * so there is only one system call made to do a write, unless we actually + * have a need to wait. This way, we get better performance. + * If the descriptor is blocking, all assumptions on the guaranteed + * detail do not apply anymore. + * Also note that in the current implementation, the delay is per-write, + * so you still have no guarantees, anyways. + * Fortunately the routine is only used in a few places (cli.c, manager.c, + * res_agi.c) so it is reasonably easy to check how it behaves there. + * + * XXX We either need to fix the code, or fix the documentation. + */ int ast_carefulwrite(int fd, char *s, int len, int timeoutms) { /* Try to write string, but wait no more than ms milliseconds |