Dbus Threading Issue
Vinoth V
v.vinoth3e at gmail.com
Fri Jun 8 02:53:53 PDT 2012
Hi all,
First let me explain my program and later will tell about the issue i am
facing with dbus.
******This is the function on the client side which is being called from
process A for 10000 times from 10 different threads ***********
static void TestfunctA(ELAPSED_TIME_STATS *et)
{
int i;
printf("\n\nstarting %s.\n", __FUNCTION__);
InitElapsedTimeSet("VZPAL_GetVideoInputStatusInfo", et); //initializing
the time_spec struct
for (i=1; i<=LoopCount; i++)
{
StartElapsedTimeMeasurement(et);// making note of the start time
Result = function1(10, &variable);
StopElapsedTimeMeasurement(et);//making note of the end time
}
DumpLatencyTimeSet(et);
DumpElapsedTimeSet(et);
}
************ client glue file which actally calls the original fucntion on
the process B which is the server *****************
eVZPAL_ReturnCode function1 (
int n,
int array[512]) // input array,
will have to be passed as Glib variant
{
GError *error = NULL;
GVariant *gvarray;
gconstpointer structFromGV;
gsize dataSize;
// call the sync version of the method,
com_our_api_call_function1_sync (proxy,
n, &gvarray, (gint*)&nResult,
NULL, &error);
if (error != NULL)
{
g_print("Error in %s, msg=\"%s\".\n", __FUNCTION__, error->message);
g_object_unref(error);
}
structFromGV = g_variant_get_fixed_array(gvarray, &dataSize, sizeof
(guchar));
memcpy(array, structFromGV, sizeof(array));
g_variant_unref(gvarray);
return nResult;
}
***********************This is the code for the Server side glue code which
runs on the process B***********************
in bus acquired function i registered the function1 with the respective
signal handler..
g_signal_connect(interface, "handle-get-function1",
G_CALLBACK(Do_function1), NULL);
static gboolean Do_function1(
ComlOurApi *interface,
GDBusMethodInvocation *invocation,
guint16 n,
int *InputStatus,
gpointer user_data)
{
GVariant *gvarray;
int array[512]; // input struct, will have
to be passed as Glib variant
// get the data from VZPALe.
nResult = function1(n, &array);
gv = g_variant_new_from_data(((const GVariantType *) "ay"), &array,
sizeof(array),
TRUE, NULL, NULL);
// send the results back to the client process
coml_our_api_complete_function1 (interface, invocation,
gvarray, (guint16) nResult);
// a little test to see if main loop calls these functions
//volatile pid_t callbackPid = getpid();
//g_print("\n mainloop pid is %x, callback pid is %x.\n", mainLoopPid,
callbackPid);
g_variant_unref(gvarray);
(void) user_data; //
return TRUE; // to indicate that we handled
}
This inturn calls a original function....
My issue is this program works perfectly fine... no errors but when i run
this client for 10000 run in 10 different threads ( i am calling the same
API)
I am gett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20120608/badf79ee/attachment.htm>
More information about the dbus
mailing list