[fpc-pascal] D-Bus. Non blocking listening for signals

dibo20 at wp.pl dibo20 at wp.pl
Thu Jan 13 15:07:57 CET 2011


This code work too:

TMyObj = class
private
procedure EventProc(AData: PtrInt; AFlags: dword);
end;

var
Sock: cint;
p: PEventHandler;

const
GLIB_SYSDEF_POLLIN = 1;
GLIB_SYSDEF_POLLOUT = 4;
GLIB_SYSDEF_POLLPRI = 2;
GLIB_SYSDEF_POLLERR = 8;
GLIB_SYSDEF_POLLHUP = 16;
GLIB_SYSDEF_POLLNVAL = 32;

ALL_FLAGS = GLIB_SYSDEF_POLLIN or GLIB_SYSDEF_POLLPRI or
GLIB_SYSDEF_POLLERR or GLIB_SYSDEF_POLLHUP or GLIB_SYSDEF_POLLNVAL;

implementation

{ TMyObj }

procedure TMyObj.EventProc(AData: PtrInt; AFlags: dword);
begin
BusReceive;
end;

....
begin
dbus_connection_get_socket(conn, @Sock);
p := AddEventHandler(Sock, ALL_FLAGS, @EventProc, 0);
end;

But it not detect eachsignal. It lost every third signal. I have no more 
ideas



More information about the fpc-pascal mailing list