Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Avoid blocking

Reply
Thread Tools

Avoid blocking

 
 
collinm
Guest
Posts: n/a
 
      04-28-2005
hi

in a c program, i copy often file on nfs

to see if i can see the nfs i do something like:

if((exist = stat(mnt_dir, &buf))==0){

if((fp = fopen(tmp_mnt_dir_www, "w"))!=NULL)
{
}
else
printf("problem\n");
}

my problem is: if nfs is not available, my program seem to block,
freeze a couple of second... is there a way to avoid that?


thanks

 
Reply With Quote
 
 
 
 
Lawrence Kirby
Guest
Posts: n/a
 
      04-28-2005
On Thu, 28 Apr 2005 08:31:18 -0700, collinm wrote:

> hi
>
> in a c program, i copy often file on nfs
>
> to see if i can see the nfs i do something like:
>
> if((exist = stat(mnt_dir, &buf))==0){
>
> if((fp = fopen(tmp_mnt_dir_www, "w"))!=NULL)
> {
> }
> else
> printf("problem\n");
> }
>
> my problem is: if nfs is not available, my program seem to block,
> freeze a couple of second... is there a way to avoid that?


Not in standard C. The delay is proably the time it takes for the system
to decide that NFS isn't responding. You might be able to tune NFS on the
system but that is well beyond the scope of the C language and this
newsgroup. You may have better luck in a newsgroup relating to your system.

Lawrence

 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      04-28-2005
collinm wrote:
>
> in a c program, i copy often file on nfs
> to see if i can see the nfs i do something like:
>
> if((exist = stat(mnt_dir, &buf))==0){
>
> if((fp = fopen(tmp_mnt_dir_www, "w"))!=NULL)
> {
> }
> else
> printf("problem\n");
> }
>
> my problem is: if nfs is not available, my program seem to block,
> freeze a couple of second... is there a way to avoid that?


This is comp.lang.c, where we discuss only the standard C language,
as defined in the C90, C99 (and older K&R) standards. This means
you must either publish the source of routines you call, or call
routines defined in the standard. stat fits into neither
category. Thus if you do get a reply it is likely to be wrong,
certainly will not be reviewed by knowledgeable people, and the
whole mess is off-topic here.

You may want to try a newsgroup that handles Posix or Unix.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

 
Reply With Quote
 
Dave Thompson
Guest
Posts: n/a
 
      05-09-2005
On Thu, 28 Apr 2005 18:01:11 +0100, Lawrence Kirby
<> wrote:

> On Thu, 28 Apr 2005 08:31:18 -0700, collinm wrote:

<snip>
> > my problem is: if nfs is not available, my program seem to block,
> > freeze a couple of second... is there a way to avoid that?

>
> Not in standard C. The delay is proably the time it takes for the system
> to decide that NFS isn't responding. You might be able to tune NFS on the


<joke> As long as NFS isn't a fish. </>

> system but that is well beyond the scope of the C language and this
> newsgroup. You may have better luck in a newsgroup relating to your system.
>

Or one for the problematic feature: comp.protocols.nfs .

- David.Thompson1 at worldnet.att.net
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Blocking IO thread-per-connection model: possible to avoid polling? Giovanni Azua Java 4 09-29-2011 08:21 PM
Avoid having a SQL express for web parts and avoid personalization Roger23 ASP .Net 2 10-12-2006 10:54 PM
SO_SNDLOWAT not avalaible; how can i avoid non-blocking sockets przemas_r@o2.pl Python 0 11-24-2004 05:03 PM
Avoid wasting time or how to avoid initialization Alexander Malkis C++ 8 04-13-2004 11:23 PM
How to avoid blocking in socket.ssl() ? Claudio Python 0 10-16-2003 06:12 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57