Sponsored Content
Full Discussion: Which is more expensive ?
Top Forums Programming Which is more expensive ? Post 302131717 by vino on Monday 13th of August 2007 10:24:55 AM
Old 08-13-2007
Quote:
Originally Posted by cbkihong
But isn't that this will only close fd up to 135? Smilie
My very bad.

I actually meant a loop which runs for 1024 against another loop which runs for 128 times in which 8 fd's are closed each time.

Code:
        for (int fd = 0; fd <= 1024; fd += 8)
        {
            close(fd);
            close(fd+1);
            close(fd+2);
            close(fd+3);
            close(fd+4);
            close(fd+5);
            close(fd+6);
            close(fd+7);
        }

I know the close call gets called 1024 times. But what about the looping part ? Is there any benefit at all ?
 

2 More Discussions You Might Find Interesting

1. Programming

calling pthread_self (on ubuntu), expensive?

Hi all, Is anyone aware of what operations are involved when a call to pthread_self() is made, obtaining the unique thread ID on a Ubuntu system (or even any Linux flavour)? Specifically, to retrieve the thread id, is there any locking required or atomic operations? I'm building an... (11 Replies)
Discussion started by: gorga
11 Replies

2. What is on Your Mind?

Very Expensive Running Shoes

You really should not need one third of the entire US budget to buy a pair of running shoes... even if they are name brand. What have these guys been smoking? It reminds me of the old joke... Customer: At those prices you aren't going to sell many shoes. Salesman: Ah, but all we need to do is... (4 Replies)
Discussion started by: Perderabo
4 Replies
smd-loop(1)						 Sync Mail Dir (smd) documentation					       smd-loop(1)

NAME
smd-loop - iterates smd-pull and smd-push SYNOPSIS
smd-loop [-vt] DESCRIPTION
smd-loop runs smd-push and smd-pull at regular intervals as defined by the user in the ~/.smd/loop configuration file. On errors that are reported to be transient, it retries a second time before failing. The configuration file is line-oriented. Each line is composed of three space separated fields: pull-frequency, push-frequency and end- point-name. Frequencies are expressed in minutes, while endpoint name is a valid name for smd-pull(1) and smd-push(1). Lines beginning with # are considered as comments. The following example calls the command smd-pull default every 3 minutes, and smd-push default every 10. Example: # pull-frequency push-frequency endpoint-name 3 10 default OPTIONS
-v Increase program verbosity (printed on stderr) -t Just create a template configuration file if none FILES
~/.smd/loop SEE ALSO
mddiff(1), smd-server(1), smd-client(1), smd-push(1), smd-pull(1) AUTHOR
Enrico Tassi <gares@fettunta.org> 11 June 2012 smd-loop(1)
All times are GMT -4. The time now is 05:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy