* [Xenomai] Corrupted files when using fwrite() or fprintf()
@ 2015-01-22 11:30 Krause, Holger
2015-01-22 11:35 ` Gilles Chanteperdrix
0 siblings, 1 reply; 3+ messages in thread
From: Krause, Holger @ 2015-01-22 11:30 UTC (permalink / raw)
To: xenomai@xenomai.org
Hello all Xenomai developers.
We run Xenomai 2.6.3 with posix skin activated.
In one thread with priority 0 - so it runs in secondary mode -
we use file io with fopen, fwrite, fclose instructions.
When writing a file via fwrite or fprintf we get a problem :
Just one part (the first) of the file has been written. The rest of the
file is missing although the fwrites/fprintfs have been executed.
The sequence is like this:
// Open file
fopen();
// Write the first part
fwrite();
// Switch the state machine to the next state to prepare the next part
// to be written to the file.
// So the system can do other things - other threads come up and so on
// Write the second part
fwrite()
// Switch the state machine to the next state to prepare the next part
// to be written to the file.
// So the system can do other things - other threads come up and so on
...
// Finally close the file
fclose();
In this situation we get some kind of a timing issue:
Only the first part of the file has been written - but the file is
closed correctly.
The statemachine works correctly so all the fwrites haben been executed
but ony the first fwrite works on the filesytem.
In another thread we use the same mechanism but everythings works there.
When I debug the code everythings works.
When I switch all the threads to linux everything works
(of course without realtime) - the file is OK.
When I insert a rt_task_sleep() after the fwrites everythings works if
the delay time is big enough (>100ms).
Switching all threads in our system to priority 0 (so that an RT thread
cannot catch the hole CPU time and the system cannot write data to
disk) does not change anything.
Does anybody have similar problems?
Best regards,
Holger Krause.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-26 11:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-22 11:30 [Xenomai] Corrupted files when using fwrite() or fprintf() Krause, Holger
2015-01-22 11:35 ` Gilles Chanteperdrix
[not found] ` <2DC6992080CF3541B10F42EBF0B5C30342F644D7@SMExchange01.siebmeyer.org>
2015-01-26 11:54 ` Gilles Chanteperdrix
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.