Re: Linux and OS wide events



neelsmail@xxxxxxxxxxxxxx wrote:
On Aug 13, 4:12 pm, Josef Moellers <josef.moell...@fujitsu-
siemens.com> wrote:
neelsm...@xxxxxxxxxxxxxx wrote:
Hi,
I am new to Linux programming (been couple of months). I am writing an
app that needs to dispatch events using C++ (to start with). Event
subscriber can be any app on the machine. I know how would I do this
on Windows but I am not able to figure out how can I do that on Linux.
For an example, if my app changes configuration, I should be able to
send OnConfigurationChanged() event. Can you tell me how I can do that
on Linux?
Have a look at dbus.

--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details:http://www.fujitsu-siemens.com/imprint.html

Thanks for your reply. I looked a dbus and it seems that it may
increase the dependency which may not be allowed in my project. Isn't
it possible to use something simpler instead?

- App that wants to receive a event loads a DL(L).
- Adds itself as a subcriber
- Shared library keeps track of all the event subscribers (This is
where I am stuck at) and once event is fired, sends the notification.

In windows, in theory, I should be able to do it using DLLs with
shared segment but on linux I am confused about .so and .dl and how to
implement shared dll that has the same copy of data for irrespective
of how many subscribers load it.

As Jens writes, two processes do share read-only code but do not share writable data ... in general.
You could do what you want with a shared memory segment, but (without thinking it through to the end), I would estimate that process synchronization and storage management will be a nightmare.

But you don't have to use dbus (although it's always best to use some tried-and-tested components), but you could whip something up yourself:
Take a single process which opens a (e.g. unix domain) socket and waits for processes to connect. On connected sockets, it then receives registration requests and messages. Registration requests will cause the socket the request appeared on to be added to the list of sockets messages of the requested kind will be "broadcasted" to. Messages will be sent to each socket that has been registered for that messages' types.

YMMV,

Josef
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
.



Relevant Pages

  • Re: Cost of ownership: MV vs. SQL Server
    ... >>app server independent, etc, but you cannot be all of those at once. ... > mention that .NET seems to satisfy all of the business requirements ... (both Macs & Linux), so my criteria are different from yours. ... > and this market has never expressed a real need for Mac, ...
    (comp.databases.pick)
  • Re: Query to the Linux community....Follow up...
    ... There were analogies to cars and PC hardware. ... > distributions of Linux may not be much of an issue. ... If the OS doesn't break on them, they'll only care what the app is doing. ... But then again, strictly speaking, Oracle doesn't sell databases. ...
    (alt.os.linux)
  • Re: Is VMS losing the Financial Sector, also?
    ... Is VMS losing the Financial Sector, ... different Dev/Test/Prod Linux environments. ... For small-med shops, its not so much as big an issue if you have ... According to my company's development group, our app runs ...
    (comp.os.vms)
  • Re: Is VMS losing the Financial Sector, also?
    ... Is VMS losing the Financial Sector, ... different Dev/Test/Prod Linux environments. ... For small-med shops, its not so much as big an issue if you have ... According to my company's development group, our app runs ...
    (comp.os.vms)
  • CF GPRS-MODEM card on Intel HCCCBCTA1/Cotulla Platform,problem with serial port
    ... Linux version 2.4.19-rmk7-pxa2; ... CPU: XScale-PXA250 revision 1 ... Initializing RT netlink socket ... Keyboard reset failed, no ACK ...
    (Linux-Kernel)