Hi,
I've a pro*c program which uses threads. Many a times, a thread exits due
to its inability to obtain locks over a period of time.
Here is the sample of what i've written:-
Any ideas or suggestions on optimising a multithreaded pro*c program?
for(::)
{
..........
--- my program code is here ----
It recieves packets from a client and stores them in the database
Hence I need to obtain lock.
.............
for(i=0;;i++)
{
if(i>gMaxLockAtmpts)
{
logMsg("Cannot get dbmutex lock !!! Exiting thread...");
brk=1;
break;
}
if( mutex_trylock( &dbmutex[idx] ) == 0 ) break;
sched_yield();
}
if( brk ) {
sleep(3); /* invoking thread alone sleeps */
break;
}
}
close(socket)
pthread_exit((void *)0);
}
This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
Oracle LazyDBA home page