Go to Post I have many ideas, every last one of them involves finding something more productive to do with your time. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #31   Spotlight this post!  
Unread 04-02-2010, 10:54
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: ofstream (standard C++ file output) not working

Right, so if it is called before fopen() in the same thread, why would there be a race condition?

I think we're having some kind of communication disconnect. Sorry.
__________________
Reply With Quote
  #32   Spotlight this post!  
Unread 04-02-2010, 13:08
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: ofstream (standard C++ file output) not working

Quote:
Originally Posted by slavik262 View Post
Right, so if it is called before fopen() in the same thread, why would there be a race condition?
You would not. The situation described above (or how I read it anyway) was that you were not calling Priv_SetWriteFileAllowed, and that it sometimes worked. I was suggesting that there are other tasks that may be calling it that would allow the write to work sometimes and not others.

If what you are saying is that you are calling it in the same task before the fopen and it still only works some of the time, then I don't have a good theory for you. Let me know if this is the case and I'll try to look into it a bit more.

-Joe

Last edited by jhersh : 04-02-2010 at 15:21.
Reply With Quote
  #33   Spotlight this post!  
Unread 04-02-2010, 15:20
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: ofstream (standard C++ file output) not working

A race condition would make sense, originally, I had the write in the simple template constructor, later i put it in the auto. I will test out the race condition today. My plan:
write to file in entry point function before anything else
write to file in robot constructor
write to file in robot auto after 10 second wait

they will be tested 10 times without priv_set..., and 10 times with priv_set...
I will report back later
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #34   Spotlight this post!  
Unread 04-02-2010, 19:09
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: ofstream (standard C++ file output) not working

Hmm, I am not seeing any blocked attempts to write; Every test was successful, without the priv_set... Sometimes it took up to 10 seconds to find it over FTP, but every test was successful
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #35   Spotlight this post!  
Unread 04-02-2010, 19:12
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: ofstream (standard C++ file output) not working

Quote:
Originally Posted by byteit101 View Post
Sometimes it took up to 10 seconds to find it over FTP, but every test was successful
Make sure your FTP client is not caching the directory listing. What client are you using?
Reply With Quote
  #36   Spotlight this post!  
Unread 05-02-2010, 06:29
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: ofstream (standard C++ file output) not working

Quote:
Originally Posted by jhersh View Post
Make sure your FTP client is not caching the directory listing. What client are you using?
FileZilla
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #37   Spotlight this post!  
Unread 05-02-2010, 15:40
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: ofstream (standard C++ file output) not working

Quote:
Originally Posted by byteit101 View Post
FileZilla
Hmm... should be fine as long as you refresh and are connected. Have you tried putting prints to go along with your writes to get some idea of when the write happened vs. when you see the file on the FTP server?
Reply With Quote
  #38   Spotlight this post!  
Unread 05-02-2010, 15:49
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: ofstream (standard C++ file output) not working

no, but I think it might be the code is slow (I only immediatly looked at the folder for a few test), you hit Run kernel task and it downloads, (I was measuring from that point), it calls the entry point function, and inits everything before creating the file
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #39   Spotlight this post!  
Unread 05-02-2010, 18:27
davidalln's Avatar
davidalln davidalln is offline
World's Worst Coder
AKA: David Allen
FRC #2415 (The Westminster Wiredcats)
Team Role: Programmer
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Atlanta, GA
Posts: 108
davidalln is on a distinguished road
Send a message via AIM to davidalln
Re: ofstream (standard C++ file output) not working

We finally got our log working consistently (although not as sophisticated as 3132's Logger, it's a foundation in which stuff can be added on). It looks like the race condition problems listed above were the culprit. The key is not to completely overwhelm it with added lines in the main loop.

We have wrapped it in a class if anyone's interested: http://gist.github.com/296373
__________________
SANTOSH ANDREW DECKER RICK WYNNIE SEAN DEREK MATT
(alamo (semis), p'tree (CHAMPS!), nc (CHAMPS!), newton (quarters))


Best four years of my life. Thanks to everyone who made it happen.

Last edited by davidalln : 05-02-2010 at 18:36.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
p2 not working? Lone_Wolf92c Programming 5 22-02-2008 08:49
IR Board Not Working (But NOT Fried) itsme Electrical 2 18-02-2008 06:11
Beware - transmission output shaft is not 5/8"! jskene Kit & Additional Hardware 30 13-02-2006 14:01
Drive() Not a Standard Toolset in EasyC? Chris_Elston Programming 3 08-02-2006 09:01
Beware - transmission output shaft is not 5/8"! jskene Technical Discussion 3 19-01-2006 14:24


All times are GMT -5. The time now is 12:31.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi