Re: ORBit2 threading patches ...
- From: Mark McLoughlin <mark skynet ie>
- To: Michael Meeks <michael ximian com>
- Cc: orbit <orbit-list gnome org>,Christophe Fergeau <teuf users sourceforge net>,Sebastian Wilhelmi <wilhelmi ira uka de>
- Subject: Re: ORBit2 threading patches ...
- Date: 14 Feb 2003 14:49:29 +1300
Hi Michael,
On Tue, 2003-02-11 at 06:29, Michael Meeks wrote:
> Hi Mark,
>
> On Sun, 2003-02-09 at 20:10, Mark McLoughlin wrote:
> > * I don't like the idea of extending the ThreadPolicy enum - just out
> > of pure spec lovery. I'd suggest something like
> >
> > ORBit_Adaptor_set_threading_hint (adaptor, THREAD_PER_OBJECT);
> >
> > and the hint would only be honoured with ORB_CTRL_MODEL.
>
> Is it adultery ? I just copied the values from ORBit-mt, I presumed
> they were part of the spec. that we just hadn't implemented as yet - if
> not, we should do that. I've just committed it all to get it off my
> disk, (and since it passes all the tests nicely now in ST mode, and
> seems fine with MT enabled, doing ST stuff ;-).
>
> > * Also, I wouldn't change the default policy list - just interpret
> > ORB_CTRL_MODEL with no hint as single threaded ...
>
> Oh, quite probably - someone ought to read the spec I suppose :-)
"someone" ? pffft :-)
Attached is a patch to both of the above. Look okay to you?
Good Luck,
Mark.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/ORBit2/ChangeLog,v
retrieving revision 1.446
diff -u -p -r1.446 ChangeLog
--- ChangeLog 11 Feb 2003 04:11:36 -0000 1.446
+++ ChangeLog 14 Feb 2003 01:50:22 -0000
@@ -1,3 +1,21 @@
+2003-02-14 Mark McLoughlin <mark@skynet.ie>
+
+ * include/orbit/poa/orbit-adaptor.h: add
+ ORBit_ObjectAdaptor_(get|set)_thread_hint.
+
+ * src/idl/misc/PortableServer.idl: kill non spec compliant
+ ThreadPolicy enum values.
+
+ * src/orb/poa/orbit-adaptor.c:
+ (ORBit_ObjectAdaptor_set_thread_hint),
+ (ORBit_ObjectAdaptor_get_thread_hint): impl.
+ (ORBit_adaptor_setup): init the hint.
+
+ * src/orb/poa/poa.c:
+ (queue_request): split out from handle_request().
+ (ORBit_POA_handle_request): upd and treat ORB_CTRL mode
+ with no hint just like single threaded mode.
+
2003-02-11 Mark McLoughlin <mark@skynet.ie>
* Makefile.am, ORBit-imodule-2.0.pc.in,
Index: include/orbit/poa/orbit-adaptor.h
===================================================================
RCS file: /cvs/gnome/ORBit2/include/orbit/poa/orbit-adaptor.h,v
retrieving revision 1.6
diff -u -p -r1.6 orbit-adaptor.h
--- include/orbit/poa/orbit-adaptor.h 24 Feb 2002 07:52:11 -0000 1.6
+++ include/orbit/poa/orbit-adaptor.h 14 Feb 2003 01:50:22 -0000
@@ -5,6 +5,20 @@
G_BEGIN_DECLS
+typedef enum {
+ ORBIT_THREAD_HINT_NONE = 0,
+ ORBIT_THREAD_HINT_PER_OBJECT,
+ ORBIT_THREAD_HINT_PER_REQUEST,
+ ORBIT_THREAD_HINT_PER_POA,
+ ORBIT_THREAD_HINT_PER_CONNECTION
+} ORBitThreadHint;
+
+typedef struct ORBit_ObjectAdaptor_type *ORBit_ObjectAdaptor;
+
+void ORBit_ObjectAdaptor_set_thread_hint (ORBit_ObjectAdaptor adaptor,
+ ORBitThreadHint thread_hint);
+ORBitThreadHint ORBit_ObjectAdaptor_get_thread_hint (ORBit_ObjectAdaptor adaptor);
+
#ifdef ORBIT2_INTERNAL_API
void ORBit_handle_request (CORBA_ORB orb,
@@ -89,8 +103,7 @@ struct ORBit_OAObject_type {
#ifdef ORBIT2_INTERNAL_API
-typedef struct ORBit_ObjectAdaptor_type *ORBit_ObjectAdaptor;
-typedef CORBA_sequence_CORBA_octet ORBit_AdaptorKey;
+typedef CORBA_sequence_CORBA_octet ORBit_AdaptorKey;
typedef void (*ORBitReqHandlerFunc) (ORBit_ObjectAdaptor adaptor,
GIOPRecvBuffer *recv_buffer,
@@ -102,6 +115,8 @@ struct ORBit_ObjectAdaptor_type {
ORBitReqHandlerFunc handle_request;
ORBit_AdaptorKey adaptor_key;
+
+ ORBitThreadHint thread_hint;
};
int ORBit_adaptor_setup (ORBit_ObjectAdaptor adaptor, CORBA_ORB orb);
Index: src/idl/misc/PortableServer.idl
===================================================================
RCS file: /cvs/gnome/ORBit2/src/idl/misc/PortableServer.idl,v
retrieving revision 1.4
diff -u -p -r1.4 PortableServer.idl
--- src/idl/misc/PortableServer.idl 10 Feb 2003 15:03:38 -0000 1.4
+++ src/idl/misc/PortableServer.idl 14 Feb 2003 01:50:24 -0000
@@ -41,11 +41,7 @@ module PortableServer {
enum ThreadPolicyValue {
ORB_CTRL_MODEL,
- THREAD_PER_OBJECT,
- SINGLE_THREAD_MODEL,
- THREAD_PER_REQUEST,
- THREAD_PER_POA,
- THREAD_PER_CONNECTION
+ SINGLE_THREAD_MODEL
};
interface ThreadPolicy : CORBA::Policy {
readonly attribute ThreadPolicyValue value;
Index: src/orb/poa/orbit-adaptor.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/poa/orbit-adaptor.c,v
retrieving revision 1.17
diff -u -p -r1.17 orbit-adaptor.c
--- src/orb/poa/orbit-adaptor.c 10 Feb 2003 15:03:42 -0000 1.17
+++ src/orb/poa/orbit-adaptor.c 14 Feb 2003 01:50:24 -0000
@@ -8,6 +8,25 @@
#include "orbit-poa.h"
#include "../orb-core/orbit-debug.h"
+void
+ORBit_ObjectAdaptor_set_thread_hint (ORBit_ObjectAdaptor adaptor,
+ ORBitThreadHint thread_hint)
+{
+ g_return_if_fail (adaptor != NULL);
+ g_return_if_fail (thread_hint >= ORBIT_THREAD_HINT_NONE &&
+ thread_hint <= ORBIT_THREAD_HINT_PER_CONNECTION);
+
+ adaptor->thread_hint = thread_hint;
+}
+
+ORBitThreadHint
+ORBit_ObjectAdaptor_get_thread_hint (ORBit_ObjectAdaptor adaptor)
+{
+ g_return_val_if_fail (adaptor != NULL, ORBIT_THREAD_HINT_NONE);
+
+ return adaptor->thread_hint;
+}
+
CORBA_long
ORBit_adaptor_setup (ORBit_ObjectAdaptor adaptor,
CORBA_ORB orb)
@@ -23,6 +42,8 @@ ORBit_adaptor_setup (ORBit_ObjectAdaptor
g_ptr_array_index (orb->adaptors, adaptor_id) = adaptor;
}
LINC_MUTEX_UNLOCK (ORBit_RootObject_lifecycle_lock);
+
+ adaptor->thread_hint = ORBIT_THREAD_HINT_NONE;
adaptor->adaptor_key._length = ORBIT_ADAPTOR_PREFIX_LEN;
adaptor->adaptor_key._buffer =
Index: src/orb/poa/poa.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/poa/poa.c,v
retrieving revision 1.84
diff -u -p -r1.84 poa.c
--- src/orb/poa/poa.c 10 Feb 2003 15:03:42 -0000 1.84
+++ src/orb/poa/poa.c 14 Feb 2003 01:50:28 -0000
@@ -1195,6 +1195,21 @@ local_main_handle (gpointer data)
return FALSE;
}
+/* Utter hack ... */
+static void
+queue_request (ORBit_POAObject pobj,
+ GIOPRecvBuffer *recv_buffer)
+{
+ LocalClosure *lc;
+
+ lc = g_new0 (LocalClosure, 1);
+
+ lc->pobj = pobj;
+ lc->recv_buffer = recv_buffer;
+
+ g_idle_add (local_main_handle, lc);
+}
+
static void
ORBit_POA_handle_request (PortableServer_POA poa,
GIOPRecvBuffer *recv_buffer,
@@ -1234,24 +1249,20 @@ ORBit_POA_handle_request (PortableServer
else {
if (giop_threaded ()) {
switch (poa->p_thread) {
- case PortableServer_SINGLE_THREAD_MODEL: {
- /* Utter hack ... */
- LocalClosure *lc = g_new0 (LocalClosure, 1);
- lc->pobj = pobj;
- lc->recv_buffer = recv_buffer;
- g_idle_add (local_main_handle, lc);
+ case PortableServer_SINGLE_THREAD_MODEL:
+ queue_request (pobj, recv_buffer);
break;
- }
+ case PortableServer_ORB_CTRL_MODEL: {
+ ORBit_ObjectAdaptor adaptor = (ORBit_ObjectAdaptor) poa;
- case PortableServer_ORB_CTRL_MODEL:
- case PortableServer_THREAD_PER_OBJECT:
- /* Impl. the above first */
- case PortableServer_THREAD_PER_REQUEST:
- case PortableServer_THREAD_PER_POA:
- case PortableServer_THREAD_PER_CONNECTION:
- g_warning ("Binning incoming requests in threaded mode");
- giop_recv_buffer_unuse (recv_buffer);
+ if (adaptor->thread_hint == ORBIT_THREAD_HINT_NONE)
+ queue_request (pobj, recv_buffer);
+ else {
+ g_warning ("Binning incoming requests in threaded mode");
+ giop_recv_buffer_unuse (recv_buffer);
+ }
break;
+ }
default:
g_assert_not_reached ();
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]