From: sebastien person <sebastien.person@sycomore.fr>
To: Bart Trojanowski <bart@jukie.net>
Cc: liste noyau linux <linux-kernel@vger.kernel.org>
Subject: Re: [newbie] timer in module
Date: Fri, 18 May 2001 15:33:47 +0200 [thread overview]
Message-ID: <20010518153347.188888ba.sebastien.person@sycomore.fr> (raw)
In-Reply-To: <Pine.LNX.4.33.0105180814170.18504-100000@localhost>
In-Reply-To: <20010518135441.59bab0ce.sebastien.person@sycomore.fr> <Pine.LNX.4.33.0105180814170.18504-100000@localhost>
Le Fri, 18 May 2001 08:32:33 -0400 (EDT)
Bart Trojanowski <bart@jukie.net> a ecrit :
> On Fri, 18 May 2001, sebastien person wrote:
>
> > I have a network module that need to regularly get data from network
> > adaptater.
> > But I don't know if it safe to do a loop with a timer in the module.
>
> First off you have to decide where you want to run your 'get data'.
There
> are three context you can pick from: user priority or from the kernel.
If
> you run the loop below from a user context then you will have a very
> unresponsive system but at least other things will still run. If you
run
> that from a kernel context nothing else will run... unless you
explicitly
> call the scheduler.
So the fact to call the scheduler allow me to handle send request for
example ?
>
> > My aim is to do a get data call every x seconds (x is variable).
>
> You mentioned a timer... it runs in kernel context but at least it
> will not end up hanging your system up. This is how you would use one:
>
> struct tq_struct timer;
> init_timer(&timer);
> timer.routine = func;
> timer.data = something;
> mod_timer(&timer, 5*HZ); // 5 seconds from now
>
> void func( unsigned long something ) {
> get_data( something );
> mod_timer(&timer, 5*HZ); // again in 5 seconds
> }
>
> Make sure you call 'del_timer_sync' once you are done.
>
> > Is it better to let an external program executing timer call and get
data
> > call via ioctl ?
>
> Since you are getting data every 5 seconds you may as well use a user
> space program. It does not seem like you are looking for phenomenal
> responsiveness here.
>
> Bart.
>
> --
> WebSig: http://www.jukie.net/~bart/sig/
Thanks for all these details
next prev parent reply other threads:[~2001-05-18 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-18 11:54 sebastien person
2001-05-18 12:32 ` Bart Trojanowski
2001-05-18 12:43 ` Alan Cox
2001-05-18 13:28 ` sebastien person
2001-05-18 13:53 ` Alan Cox
2001-05-18 13:33 ` sebastien person [this message]
2001-05-18 13:54 ` Richard B. Johnson
2001-05-22 10:53 sebastien person
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=20010518153347.188888ba.sebastien.person@sycomore.fr \
--to=sebastien.person@sycomore.fr \
--cc=bart@jukie.net \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®