| |
 |
|
|
Linux Forum Index » Linux Development - Applications » Linux and OS wide events...
Page 2 of 2 Goto page Previous 1, 2
|
| Author |
Message |
| Timothy Baldwin... |
Posted: Thu Aug 14, 2008 2:51 am |
|
|
|
Guest
|
In message
<f19e3c71-af5c-4535-bf3d-ff07bd8d2d38 at (no spam) r15g2000prh.googlegroups.com>,
neelsmail at (no spam) rediffmail.com <neelsmail at (no spam) rediffmail.com> wrote:
Quote: - While my app is running it makes some changes to the configuration,
for example, creates or deletes a file.
The inotify interface allows you the track changes to files on the
filesystem. |
|
|
| Back to top |
|
| Rainer Weikusat... |
Posted: Thu Aug 14, 2008 4:55 am |
|
|
|
Guest
|
David Schwartz <davids at (no spam) webmaster.com> writes:
Quote: On Aug 13, 8:10 am, neelsm... at (no spam) rediffmail.com wrote:
I am not sure how I can do this. Use dbus but use my own daemon?
Exactly. Use your own dbus daemon. That way, you are not dependent on
the system running a dbus daemon.
DO NOT DO THAT. If you want to use facilities provided by dbus, make
your application dependent on dbus being availabe on any system it is
supposed to run on. That's going to be a pain in the ass for everyone
except Fedore Core desktop users with fast (multicore?) desktop PCs
(slight xaggeration) , but still less of a nuisance than having twenty
different dbus-daemons running on the same system, each serving the
need of exactly one application and being based on a random, outdated
version of the dbus code base.
And don't listen to people who think that each application requiring
its own compiler for such recommendations. That would be anyone still
using C++. |
|
|
| Back to top |
|
| Rainer Weikusat... |
Posted: Thu Aug 14, 2008 4:57 am |
|
|
|
Guest
|
David Schwartz <davids at (no spam) webmaster.com> writes:
Quote: On Aug 13, 8:10 am, neelsm... at (no spam) rediffmail.com wrote:
I am not sure how I can do this. Use dbus but use my own daemon?
Exactly. Use your own dbus daemon. That way, you are not dependent on
the system running a dbus daemon.
DO NOT DO THAT. If you want to use facilities provided by dbus, make
your application dependent on dbus being availabe on any system it is
supposed to run on. That's going to be a pain in the ass for everyone
except Fedore Core desktop users with fast (multicore?) desktop PCs
(slight xaggeration) , but still less of a nuisance than having twenty
different dbus-daemons running on the same system, each serving the
need of exactly one application and being based on a random, outdated
version of the dbus code base.
And don't listen to people who think that each application requiring
its own compiler is fine, too, for such recommendations. That would be
anyone still using g++. |
|
|
| Back to top |
|
| Rainer Weikusat... |
Posted: Thu Aug 14, 2008 5:58 am |
|
|
|
Guest
|
David Schwartz <davids at (no spam) webmaster.com> writes:
Quote: On Aug 14, 2:55 am, Rainer Weikusat <rweiku... at (no spam) mssgmbh.com> wrote:
DO NOT DO THAT. If you want to use facilities provided by dbus, make
your application dependent on dbus being availabe on any system it is
supposed to run on. That's going to be a pain in the ass for everyone
except Fedore Core desktop users with fast (multicore?) desktop PCs
(slight xaggeration) , but still less of a nuisance than having twenty
different dbus-daemons running on the same system, each serving the
need of exactly one application and being based on a random, outdated
version of the dbus code base.
What is the advantage of *requiring* a system-installation of dbus?
A system installation of dbus is required when applications using dbus
are to be used. You are correct insofar as 'using IPC facility A' is
not generally 'an advantage' when compared with 'using IPC facility
B'. In the end, this just means 'use one API' or 'use another API'.
There is actually a disadvantage for the given scenario, namely, that
the OP stated that he would be comfortable solving the problem using
shared memory on Windows, so why on earth shouldn't he just use shared
memory on Linux, too, instead of adding all these useless additional
complications to the code?
But a single dbus-installation per system is sufficient. So use it. |
|
|
| Back to top |
|
| William Pursell... |
Posted: Thu Aug 14, 2008 8:08 pm |
|
|
|
Guest
|
On 13 Aug, 15:28, John Hasler <j... at (no spam) dhh.gt.org> wrote:
Quote: Neel writes:
Yes, shared memory segment idea is I think what I am looking for.
A file would work as well.
So that, if I create, for the sake of it, a map of event vs. subscriber,
I should be able to create it in shared memory segment so that when my
app tries to find the subscriber, it always have ALL the subscriber.
Seems excessively complex. Just have your main program write its message
to the file or shared memory segment and signal all the subscribed
processes. They can then read the message and decide what, if anything, to
do. The message should contain all the information any process could
possibly need.
1) Main program starts up, opens socket, opens message file/creates shared
memory segment, puts "default" message there (including, perhaps, the
socket it is listening on).
2) Auxillary process starts up, reads message, configures itself
accordingly, writes PID to socket.
4) Main program makes a change, writes message describing it to file/shared
memory, signals all subscribed processes.
5) Subscribed process receives signal, reads message, reacts appropriately.
Agreeing that dbus is better, if you do choose to do something
like the above (what happened to 3?) it can be simpler. The
main app doesn't actually need to know who the subscribers
are. The app can make a change and write it out to the
filesystem, and the 'subscriber' can subscribe not with
the main app but with the kernel via inotify. When the
main app writes the configuration change, the kernel
will signal the subscribers. |
|
|
| Back to top |
|
| Bob Smith... |
Posted: Fri Aug 15, 2008 12:48 am |
|
|
|
Guest
|
Neel,
D-Bus is the traditional way to do what you're
requesting but if you roll your own you should take a
look at /dev/fanout. It is a fairly simple broadcast
IPC mechanism.
Bob Smith
neelsmail at (no spam) rediffmail.com wrote:
Quote: Here is what I want to do:
- While my app is running it makes some changes to the configuration,
for example, creates or deletes a file.
- Other applications that depend on working on my application want to
know as soon as my app have done that.
- The usual way for them to know it is by polling but these are not
the only changes I will do. In next version I may want to include
creating/deleting users therefore I want to keep it as generic as
possible.
- There is another way for other apps to know this is by getting
system wide events but it would be difficult for them to find out who
exactly did this.
- Therefore, I was thinking about sending (broadcasting) events to all
the subscribers.
- Another way to deal with this is to actually broadcast the event but
I do not know how to broadcast the event to all applications along
with data in Linux as well.
- In addition to this, there might be a time when my app will not be
allowed to (actually) broadcast the events to ALL the apps in the
system.
Because of all this, I was thinking of implementing a simple event
reporting mechanism based on subscribers. One way I thought of doing
this by finding out whether I have parallel method in Linux to that of
Windows. Since COM is out, the other way I thought of doing this was
using shared libraries/data.
I imagine this makes it clearer.
Thanks in advance,
-Neel. |
|
|
| Back to top |
|
| Rainer Weikusat... |
Posted: Fri Aug 15, 2008 4:09 am |
|
|
|
Guest
|
Bob Smith <usenet at (no spam) linuxtoys.org> writes:
Quote: Neel,
D-Bus is the traditional way to do what you're
requesting
The 0.11 release was in 2003. |
|
|
| Back to top |
|
| Jasen Betts... |
Posted: Fri Aug 15, 2008 4:29 am |
|
|
|
Guest
|
On 2008-08-13, neelsmail at (no spam) rediffmail.com <neelsmail at (no spam) rediffmail.com> wrote:
Quote: Hi Jens,
Here is what I want to do:
- While my app is running it makes some changes to the configuration,
for example, creates or deletes a file.
- Other applications that depend on working on my application want to
know as soon as my app have done that.
that is exactly what fam is for.
(future features skipped)
Quote: Because of all this, I was thinking of implementing a simple event
reporting mechanism based on subscribers. One way I thought of doing
this by finding out whether I have parallel method in Linux to that of
Windows. Since COM is out, the other way I thought of doing this was
using shared libraries/data.
sound like a forked fifo would solve that...
or is it called a broadcast socket?? um... I read about it somewhere
last month....
Bye.
Jasen |
|
|
| Back to top |
|
| Andrew Halliwell... |
Posted: Fri Aug 15, 2008 4:31 am |
|
|
|
Guest
|
Jens Thoms Toerring <jt at (no spam) toerring.de> wrote:
Quote: This doesn't exist. Each process loading a shared library gets its
own, private copy of the data. What would it make sense for to have
data shared between unrelated processes?
Not as a DLL, no. But linux does have a concept of "shared memory" where
processes can communicate with each other and pass each other data.
Maybe that's what he's looking for.
There're other ways such as message passing and named pipes too.
But if you want a common pool readable by every process, shared memory would
be the way to go.
--
| spike1 at (no spam) freenet.co,uk | "Are you pondering what I'm pondering Pinky?" |
| Andrew Halliwell BSc | |
| in | "I think so brain, but this time, you control |
| Computer Science | the Encounter suit, and I'll do the voice..." | |
|
|
| Back to top |
|
| |
Page 2 of 2 Goto page Previous 1, 2
All times are GMT - 5 Hours
The time now is Fri Nov 21, 2008 8:40 pm
|
|