From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4E153BFA.601@domain.hid> Date: Thu, 07 Jul 2011 06:54:18 +0200 From: Gilles Chanteperdrix MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai-help] Xenomai 2.5.3 vs gettimeofday() --> livelock? List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeremy Friesner Cc: xenomai@xenomai.org On 07/06/2011 10:38 PM, Jeremy Friesner wrote: > My first question is: Am I right in suspecting that gettimeofday() > can occasionally spin/livelock, when called from a Xenomai 2.5.3 > real-time thread? FWIW, it gets called from the real-time thread > once every 333mS. Yes, this is a known issue. > > And if that is the case, my second question is: Is there an > alternative "safe" way to call gettimeofday() (or something > equivalent) so that the real-time thread can find out the current PTP > system time? Or do I need to re-write my code so that the real-time > thread never calls gettimeofday()? > > Is there a recommended practice for using Xenomai threads in > conjunction with PTP? There are several ways out: - the rtdk library provides a version of gettimeofday which switches to secondary mode before calling the real gettimeofday. In order to use it, you have to link your application with: -Wl,--wrap,gettimeofday -lrtdk - you can forcibly emit the syscall like the clocktest application does. -- Gilles.