Commit e6e1c7b8 authored by Arne Øslebø's avatar Arne Øslebø

added --enable-withoutlocking option to turn off mutex locking in mapidlib

git-svn-id: file:///home/svn/mapi/trunk@1020 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 0c656259
......@@ -364,6 +364,22 @@ else
AC_MSG_RESULT(no)
fi
#No locking in mapidlib
AC_MSG_CHECKING(if locking is disabled in mapidlib)
AC_ARG_ENABLE(withoutlocking,
AS_HELP_STRING([--enable-withoutlocking], [Disable locking inside mapidlib to increase performance.]),
[case "${enableval}" in
yes) withoutlocking=true ;;
no) withoutlocking=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-withoutlocking) ;;
esac], [withoutlocking=false])
if test x$funcstats = xtrue; then
AC_DEFINE(WITHOUT_LOCKING, 1, [disable locking])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
# Checks for libraries
AC_MSG_NOTICE([libraries ---------------------------------------------------])
......
......@@ -1139,9 +1139,11 @@ void mapid_process_pkt(mapidlib_instance_t *i,
if(funct->ref==1)
ret=funct->instance->ret;
else {
#ifndef WITHOUT_LOCKING
if(funct->instance->def->restype == MAPIRES_SHM) {
pthread_mutex_lock(i->shm_spinlock);
}
#endif
#ifdef WITH_MODIFY_PKTS
if(flow->modifies==1)
ret=funct->instance->def->process(funct->instance,flow->mod_pkt,flow->mod_pkt+devhlength,&flow->mod_pkt_head);
......@@ -1150,9 +1152,11 @@ void mapid_process_pkt(mapidlib_instance_t *i,
#else
ret=funct->instance->def->process(funct->instance,dev_pkt,link_pkt,pkt_head);
#endif
#ifndef WITHOUT_LOCKING
if(funct->instance->def->restype == MAPIRES_SHM) {
pthread_mutex_unlock(i->shm_spinlock);
}
#endif
#ifdef WITH_FUNCT_STATS
funct->instance->pkts++;
if(ret)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment