From: "Alessio Margan @ IIT" <alessio.margan@domain.hid>
To: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: [Xenomai-help] thread and posix skin
Date: Mon, 18 Jan 2010 15:45:18 +0100 [thread overview]
Message-ID: <4B5473FE.7050704@domain.hid> (raw)
Hi,
I've got problem using pthread_make_periodic_np and pthread_wait_np.
Should I make some particular initializations ?
CONFIG_XENO_OPT_TIMING_PERIOD=y have sense ?
In the examples and testsuite I 've just seen the use of clock_nanosleep
with pthread,
should I use it instead of pthread_make_periodic_np ?
This is the thread routine, I get error on pthread_wait_np() return code
110.
void * rt_thread(void * arg, rt_thread_hook_t * hook)
{
thread_info_t * th_info = (thread_info_t *)arg;
int ret = 0;
struct timespec starttp, periodtp;
//
if ( hook ) { hook->init(0); }
printf("THREAD INIT: name = %s, period %ld us\n",
th_info->name, th_info->period.period.tv_usec);
ret = pthread_set_name_np(pthread_self(), th_info->name);
if ( ret != 0 ) {
printf("%s : pthread_set_name_np() return code %d\n",
th_info->name, ret);
exit(1);
}
periodtp.tv_sec = 0ULL;
periodtp.tv_nsec = th_info->period.period.tv_usec * 1000ULL;
clock_gettime(CLOCK_REALTIME, &starttp);
starttp.tv_sec += 1ULL;
starttp.tv_nsec += periodtp.tv_nsec;
ret = pthread_make_periodic_np(pthread_self(), &starttp, &periodtp);
if ( ret != 0 ) {
printf("%s : pthread_make_periodic_np() return code %d\n",
th_info->name, ret);
exit(1);
}
while (loop) {
if ( hook ) { hook->loop(0); }
// return 0 if the period expires as expected
ret = pthread_wait_np(NULL);
if ( ret != 0 ) {
printf("%s : pthread_wait_np() return code %d\n", th_info->name, ret);
exit(1);
}
}
//
if ( hook ) { hook->shutdown(0); }
printf("THREAD %s ENDS\n", th_info->name);
return 0;
}
TIA
Alessio
--
ISTITUTO ITALIANO
DI TECNOLOGIA
Alessio Margan
/Senior Technician/
mail me <mailto:alessio.margan@domain.hid>
Via Morego, 30 16163 Genova
<http://maps.google.com/maps?f=q&hl=en&geocode=&q=via+morego,+30+genova&sll=37.0625,-95.677068&sspn=85.420533,191.601563&ie=UTF8&ll=44.474913,8.907037&spn=0.004685,0.011652&t=h&z=17&iwloc=addr>
www.iit.it <http://www.iit.it>
*Legal Disclaimer*
This electronic message contains information that is confidential. The
information is intended for the use of the addressee only. If you are
not the addressee we would appreciate your notification in this respect.
Please note that any disclosure, copy, distribution or use of the
contents of this message is prohibited and may be unlawful. We have
taken every reasonable precaution to ensure that any kind of attachment
to this e-mail has been swept for viruses. However, we cannot accept
liability for any damage sustained as a result of software viruses and
would advise you to carry out your own virus checks before opening any
attachment.
*Avvertenza legale*
Questo messaggio Email contiene informazioni confidenziali riservate ai
soli destinatari. Qualora veniate in possesso di tali informazioni senza
essere definito come destinatario vi reghiamo di leggere le seguenti
note. Ogni apertura, copia, distribuzione del contenuto del messaggio e
dei suoi allegati è proibito e potrebbe violare le presenti leggi.
Abbiamo attivato ogni possibile e ragionevole precauzione per assicurare
che gli allegati non contengano virus. Comunque non assumeremo alcuna
responsabilità per ogni eventuale danno causato da virus software e
simili in quanto è onere del destinatario verificarne l’assenza in ogni
allegato attuando propri indipendenti controlli.
next reply other threads:[~2010-01-18 14:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-18 14:45 Alessio Margan @ IIT [this message]
2010-01-18 14:52 ` [Xenomai-help] thread and posix skin Gilles Chanteperdrix
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B5473FE.7050704@domain.hid \
--to=alessio.margan@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.