[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BOUNCE rtl@rtlinux.org: Approval required: (fwd)



>From owner-rtl Wed May  9 10:23:06 2001
Received: from hq2.fsmlabs.com (hq2.fsmlabs.com [209.155.42.199])
	by hq.fsmlabs.com (8.11.2/8.11.2) with SMTP id f49GN6J23575
	for <rtl@rtlinux.org>; Wed, 9 May 2001 10:23:06 -0600
Received: (qmail 12772 invoked by uid 1002); 9 May 2001 16:16:09 -0000
Date: Wed, 9 May 2001 10:16:09 -0600
From: Victor Yodaiken <yodaiken@fsmlabs.com>
To: rtl@fsmlabs.com
Cc: rtlinux <rtl@rtlinux.org>
Subject: Re: [rtl] bug repport
Message-ID: <20010509101609.B12221@hq2>
References: <3AF958B6.8DA04D3B@city.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.15i
In-Reply-To: <3AF958B6.8DA04D3B@city.dk>; from agn@city.dk on Wed, May 09, 2001 at 04:48:22PM +0200
Organization: FSM Labs


You cannot call Linux functions from the RT threads because 
the RT system ignores Linux synchronization.
In order to wake up a Linux process you need a two step procedure
	pthread_kill(LinuxThread(), irq)

	Linux handler:
			wake_up

See the RTfifo code for an example.


On Wed, May 09, 2001 at 04:48:22PM +0200, root wrote:
> hi all
> I think I have found a bug.
> I think the problem is that "some" kommunikation between linux kernel
> and RT-linux goes wrong.
> 
> I have made a test program. It does NOT work, and crashes -> turn off.
> The program is simple. It just start a thread running every 1/10000 sec.
> The thread wake up sleeping prosses up in the queue "my_queue".
> 
> The program start out fine, but when i try to open another program (in
> linux user space) it crashes.
> ps. I am using RT-linux 3.0 based on kernel 2.4.1
> /*
>  * this file is have only one funktion -> to test the queue structurer
>  * auther : Anders Gnistrup email : agn@city.dk
>  *----------------------------------------------------------------------*/
> 
> #include <rtl.h>
> #include <rtl_sched.h>
> #include <rtl_conf.h>
> #include <rtl_core.h>
> #include <rtl_sync.h>
> 
> 
> wait_queue_head_t my_queue;
> pthread_t queue_ID;
> void *queue(void *);
> 
> void *queue(void *t) {
>   while(1) {
>     pthread_wait_np();
>     wake_up(&my_queue);
>   }
>   return 0;
> }
> 
> int init_module(void) {
>   pthread_attr_t attr;
>   struct sched_param sched_param;
>   hrtime_t period = 1000000000/11520;
> 
>   init_waitqueue_head(&my_queue);
> 
>   pthread_attr_init(&attr);
>   sched_param.sched_priority = 4;
>   pthread_attr_setschedparam(&attr,&sched_param);
>   pthread_create(&queue_ID,&attr, queue, (void *) 0);
>   pthread_make_periodic_np(queue_ID, gethrtime(), period);
>   return 0;
> }
> 
> 
> void cleanup_module(void) {
>   pthread_suspend_np(queue_ID);
>   pthread_cancel(queue_ID);
>   pthread_join(queue_ID, NULL);
> }
> 
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/