[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["karl rentsch" <krentsch@btr-auto.aust.com>] (fwd)
- To: rtl@rtlinux.org
- Subject: BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["karl rentsch" <krentsch@btr-auto.aust.com>] (fwd)
- From: Der Herr Hofrat <der.herr@hofr.at>
- Date: Thu, 10 May 2001 06:46:35 +0200 (CEST)
>From owner-rtl Wed May 9 16:42:31 2001
Received: from mta03.mail.mel.aone.net.au (mta03.mail.au.uu.net [203.2.192.83])
by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f49MgUJ26137
for <rtl@fsmlabs.com>; Wed, 9 May 2001 16:42:30 -0600
Received: from BTR-COM1.btr-auto.aust.com ([203.108.33.26])
by mta03.mail.mel.aone.net.au with SMTP
id <20010509223822.DDYS328.mta03.mail.mel.aone.net.au@BTR-COM1.btr-auto.aust.com>
for <rtl@fsmlabs.com>; Thu, 10 May 2001 08:38:22 +1000
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: [rtl] putting threads to sleep
Content-Type: text/plain;
charset="iso-8859-1"
X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0
Date: Thu, 10 May 2001 08:39:44 +1000
Message-ID: <A3A5582AC3AFD448A7C0BD2DB7EFDC5F1143B1@BTR-COM1.btr-auto.aust.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Topic: [rtl] putting threads to sleep
Thread-Index: AcDYhrEGo2tDMMr/R+ept6pydrmqhgAUOXNQ
From: "karl rentsch" <krentsch@btr-auto.aust.com>
To: <rtl@fsmlabs.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by hq.fsmlabs.com id f49MgVJ26138
Thanks everyone, but I've got it sorted out now. I upgraded from the
development RT-Linux (3.0 pre ?) to the latest 3.0 kernal and it seems
to have solved the problem of the one-shot pthread_make_periodic
function not resetting (I can't remeber changing anything else). Here's
the code for interest:
void *can_update(void *pparams)
{
volatile sched_can_msg_t *msg;
can_output_t can_output_data;
hrtime_t time, sched_time;
int i = 0;
while(1) {
msg = can_objects->can_messages;
time = gethrtime();
sched_time = time + 10000000LL;
for(i = 0; i < can_objects->no_entries; i++) {
if(msg->id >= 0) {
if(time > (msg->last_sent +
msg->period)) {
can_output_data.msg.port = msg->channel;
can_output_data.msg.id = msg->id;
can_output_data.msg.datalen =
msg->datalen;
memcpy(&can_output_data.msg.data, &msg->data,
sizeof(can_output_data.msg.data));
rtf_put(CAN_DRV_TX_FIFO,
&can_output_data, sizeof(can_output_t));
msg->last_sent = gethrtime();
}
if(sched_time > (msg->last_sent +
msg->period)) {
sched_time = msg->last_sent +
msg->period;
}
}
msg++;
}
pthread_make_periodic_np(pthread_self(), sched_time, 0);
pthread_wait_np();
}
return 0;
}
Regards
Karl Rentsch
> karl rentsch wrote:
>
> Hi all,
>
> I've got a problem I hope someone can help me with. I'm trying to put
a
> thread to sleep but I don't want to tie up the system using usleep()
or
> nanosleep(). I've tried using pthread_make_periodic_np configured as
a
> one shot timer (ie. it needs to repeat several times but for different
> time intervals) but it doesn't seem to work
> Any help would be much appreciated
> Thanks
> Karl Rentsch