jazz123
April 27th, 2011, 12:03 AM
Hi all,
I am running a process which creates 12 threads and its function is to pass messages between other processes. Platform is montavista
The problem is :
one of its thread lock a mutex and before it can unlock it another thread try to lock that mutex and gets blocked, but for next 7 seconds no other thread get scheduled.
20 062244:538 Acquiring lock
20 062244:538 Acquired lock
20 062244:538 Message for PEER node
20 062244:676 Acquiring lock
20 062251:131 ############handleMessages: accept returned with fd:
function which was shared is
int handleMessage(void *pkt, int len)
{
int sockfd;
log("Acquiring lock");
pthread_mutex_lock(&data_handler_mutex);
log("Acquired lock");
sMessageHeader *temp = &(((sMessagePacket *)pkt)->msgHdr);
if((len != EXT_MSG_PKT_SIZE) && (len != MSG_PKT_SIZE))
log("\n ~~~~~~~ %s called for invalid length: %d",func, len); ........
please tell me what could be the problem.
I am running a process which creates 12 threads and its function is to pass messages between other processes. Platform is montavista
The problem is :
one of its thread lock a mutex and before it can unlock it another thread try to lock that mutex and gets blocked, but for next 7 seconds no other thread get scheduled.
20 062244:538 Acquiring lock
20 062244:538 Acquired lock
20 062244:538 Message for PEER node
20 062244:676 Acquiring lock
20 062251:131 ############handleMessages: accept returned with fd:
function which was shared is
int handleMessage(void *pkt, int len)
{
int sockfd;
log("Acquiring lock");
pthread_mutex_lock(&data_handler_mutex);
log("Acquired lock");
sMessageHeader *temp = &(((sMessagePacket *)pkt)->msgHdr);
if((len != EXT_MSG_PKT_SIZE) && (len != MSG_PKT_SIZE))
log("\n ~~~~~~~ %s called for invalid length: %d",func, len); ........
please tell me what could be the problem.