register events

Jelmer Vernooij jelmer at samba.org
Wed May 7 19:45:14 GMT 2003


On Wed, May 07, 2003 at 07:19:50PM +0200, Stefan (metze) Metzmacher wrote about 'Re: register events':
> At 05:44 07.05.2003 +0000, jra at dp.samba.org wrote:
> >On Wed, May 07, 2003 at 07:16:57AM +0200, Stefan (metze) Metzmacher wrote:
> >> At 05:07 07.05.2003 +0000, jra at dp.samba.org wrote:
> >> >On Wed, May 07, 2003 at 07:05:59AM +0200, Stefan (metze) Metzmacher 
> >wrote:

> >> > > what will  be better:

> >> > > int smb_register_*_event(event_struct *event)
> >> > > {
> >> > >                  return event_id;
> >> > > }

> >> >Errr. None of them. typedef a new int type of smb_event_t
> >> >and return that - #define zero as SMB_REGISTER_EVENT_FAIL
> >> >(I'm expecting the only possible failure will be ENOMEM).

> >> ok. substitute int with smb_event_id_t

> >> but with kind of funtion would you preferr? the first on?

> >Yes, if there is only one kind of error (ENOMEM) that
> >can be returned.

> In theorie we could run outof event_id's....

> Jelmer, what would you preferr?
I would prefer something like this:

int smb_register_exit_event(void (*function) (void *data), void
*data);
BOOL smb_unregister_exit_event(int event_id);

int smb_register_idle_event(time_t interval = 0, void (*function) (time_t now, time_t interval, void *data), void *data);
BOOL smb_unregister_idle_event(int event_id);

Jelmer

-- 
Jelmer Vernooij <jelmer at nl.linux.org> - http://nl.linux.org/~jelmer/
 21:42:27 up 4 days, 21:11, 14 users,  load average: 0.00, 0.11, 0.25
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20030507/5168a7de/attachment.bin


More information about the samba-technical mailing list