[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/7] proc: improve the message_demuxer function
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 5/7] proc: improve the message_demuxer function |
Date: |
Mon, 2 Dec 2013 13:01:49 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Sat 30 Nov 2013 20:11:01 +0100, a écrit :
> Handle multiple request types as recommended by the Mach Server
> Writer's Guide section 4, subsection "Handling Multiple Request
> Types". This avoids initializing the reply message in every X_server
> function. The reply message has already been properly initialized in
> libports, so there is no need to call mig_reply_setup.
>
> * proc/main.c (message_demuxer): Improve the demuxer function.
Ack.
> ---
> proc/main.c | 30 ++++++++++++++++++------------
> 1 file changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/proc/main.c b/proc/main.c
> index aaaa5a7..5d6dc21 100644
> --- a/proc/main.c
> +++ b/proc/main.c
> @@ -38,18 +38,24 @@ int
> message_demuxer (mach_msg_header_t *inp,
> mach_msg_header_t *outp)
> {
> - extern int process_server (mach_msg_header_t *, mach_msg_header_t *);
> - extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
> - extern int proc_exc_server (mach_msg_header_t *, mach_msg_header_t *);
> - int status;
> -
> - pthread_mutex_lock (&global_lock);
> - status = (process_server (inp, outp)
> - || notify_server (inp, outp)
> - || ports_interrupt_server (inp, outp)
> - || proc_exc_server (inp, outp));
> - pthread_mutex_unlock (&global_lock);
> - return status;
> + mig_routine_t process_server_routine (mach_msg_header_t *);
> + mig_routine_t notify_server_routine (mach_msg_header_t *);
> + mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
> + mig_routine_t proc_exc_server_routine (mach_msg_header_t *);
> +
> + mig_routine_t routine;
> + if ((routine = process_server_routine (inp)) ||
> + (routine = notify_server_routine (inp)) ||
> + (routine = ports_interrupt_server_routine (inp)) ||
> + (routine = proc_exc_server_routine (inp)))
> + {
> + pthread_mutex_lock (&global_lock);
> + (*routine) (inp, outp);
> + pthread_mutex_unlock (&global_lock);
> + return TRUE;
> + }
> + else
> + return FALSE;
> }
>
> pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
> --
> 1.7.10.4
>
--
Samuel
<y> update-menus: relocation error: update-menus: symbol
_ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E, version
GLIBCPP_3.2 not defined in file libstdc++.so.5 with link time reference
<y> quoi que ça peut bien vouloir dire ?
<D> N a eu la meme merde
<y> c ça que ça veut dire ? wow, c'est bien crypté :)
-+- #ens-mim s'entraide -+-
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 5/7] proc: improve the message_demuxer function,
Samuel Thibault <=