[Evolution-hackers] ORBit thread patch



This patch is in the 2.9.3 release and in CVS, but if you are using
2.8.x you can just apply the patch from Michael.  It fixes a deadlock
issue with in-proc one-way thread per request corba calls (will be
needed for the birthday/anniversary calendar backend).

-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.
--- Begin Message ---
Hi JP,

On Fri, 2004-01-09 at 14:48, JP Rosevear wrote:

	Try this for size,

	HTH,

		Michael.

-- 
 michael ximian com  <><, Pseudo Engineer, itinerant idiot
Index: include/orbit/poa/poa.h
===================================================================
RCS file: /cvs/gnome/ORBit2/include/orbit/poa/poa.h,v
retrieving revision 1.25
diff -u -p -u -r1.25 poa.h
--- include/orbit/poa/poa.h	11 Jun 2003 08:42:31 -0000	1.25
+++ include/orbit/poa/poa.h	9 Jan 2004 15:42:22 -0000
@@ -153,7 +153,8 @@ void ORBit_classinfo_register  (Portable
 
 PortableServer_ClassInfo *ORBit_classinfo_lookup                 (const char *type_id);
 void                      ORBit_POAObject_post_invoke            (ORBit_POAObject obj);
-gboolean                  ORBit_poa_allow_cross_thread_call      (ORBit_POAObject pobj);
+gboolean                  ORBit_poa_allow_cross_thread_call      (ORBit_POAObject   pobj,
+								  ORBit_IMethodFlag method_flags);
 void                      ORBit_recv_buffer_return_sys_exception (GIOPRecvBuffer    *buf,
 								  CORBA_Environment *ev);
 void                      ORBit_poa_init (void);
Index: src/orb/orb-core/orbit-small.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/orb-core/orbit-small.c,v
retrieving revision 1.93
diff -u -p -u -r1.93 orbit-small.c
--- src/orb/orb-core/orbit-small.c	8 Dec 2003 14:19:31 -0000	1.93
+++ src/orb/orb-core/orbit-small.c	9 Jan 2004 15:42:23 -0000
@@ -606,7 +606,8 @@ ORBit_small_invoke_stub (CORBA_Object   
 
 	if (adaptor_obj) {
 		/* FIXME: unchecked cast */
-		if (ORBit_poa_allow_cross_thread_call ((ORBit_POAObject) adaptor_obj)) {
+		if (ORBit_poa_allow_cross_thread_call ((ORBit_POAObject) adaptor_obj,
+						       m_data->flags)) {
 			tprintf_header (obj, m_data);
 			tprintf ("[in-proc]");
 			ORBit_small_handle_request (adaptor_obj, m_data->name, ret,
Index: src/orb/poa/poa.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/poa/poa.c,v
retrieving revision 1.113
diff -u -p -u -r1.113 poa.c
--- src/orb/poa/poa.c	3 Nov 2003 22:56:56 -0000	1.113
+++ src/orb/poa/poa.c	9 Jan 2004 15:42:24 -0000
@@ -2464,7 +2464,9 @@ ORBit_poa_init (void)
 }
 
 gboolean
-ORBit_poa_allow_cross_thread_call (ORBit_POAObject pobj)
+ORBit_poa_allow_cross_thread_call (ORBit_POAObject   pobj,
+				   ORBit_IMethodFlag method_flags)
+
 {
 	gpointer key = NULL;
 	GIOPThread *self;
@@ -2481,7 +2483,10 @@ ORBit_poa_allow_cross_thread_call (ORBit
 
 	case PortableServer_ORB_CTRL_MODEL: {
 		ORBit_ObjectAdaptor adaptor = (ORBit_ObjectAdaptor) poa;
-				
+
+		if (method_flags & ORBit_I_METHOD_1_WAY)
+			return FALSE;
+
 		switch (adaptor->thread_hint) {
 		case ORBIT_THREAD_HINT_PER_OBJECT:
 			key = pobj;
@@ -2518,7 +2523,8 @@ static gpointer
 get_c_method (CORBA_Object                 obj,
 	      glong                        class_id,
 	      PortableServer_ServantBase **servant,
-	      glong                        method_offset)
+	      glong                        method_offset,
+	      ORBit_IMethodFlag            method_flags)
 {
 	guchar *epv_start;
 	ORBit_POAObject pobj;
@@ -2532,7 +2538,7 @@ get_c_method (CORBA_Object              
 	if (method_offset <= 0 || class_id <= 0)
 		return NULL;
 
-	if (!ORBit_poa_allow_cross_thread_call (pobj))
+	if (!ORBit_poa_allow_cross_thread_call (pobj, method_flags))
 		return NULL;
 
 	if (ORBit_small_flags & ORBIT_SMALL_FORCE_GENERIC_MARSHAL)
@@ -2570,9 +2576,16 @@ ORBit_c_stub_invoke (CORBA_Object       
 	gpointer method_impl;
 	PortableServer_ServantBase *servant;
 
+	if (method_index < 0 || method_index > methods->_length) {
+		CORBA_exception_set_system (ev, ex_CORBA_NO_IMPLEMENT,
+					    CORBA_COMPLETED_NO);
+		return;
+	}
+
 	if (skel_impl &&
 	    (method_impl = get_c_method (obj, class_id,
-					 &servant, method_offset))) {
+					 &servant, method_offset,
+					 methods->_buffer[method_index].flags))) {
 		
 		/* Unwound PreCall
 		   ++( ((ORBit_POAObject)(obj)->adaptor_obj)->use_cnt );	    \

--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]