OpenSS7
SS7 for the
Common Man

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified:

Home Overview Status News Documentation Resources About
   
 Overview
 Status
 News
 Documentation
 Resources
 About

   
Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> strss7/drivers/lock.h


File /code/strss7/drivers/lock.h



#ifndef __LOCK_H__
#define __LOCK_H__

STATIC int ss7_osrv(queue_t *);
STATIC int ss7_isrv(queue_t *);

STATIC INLINE int ss7_trylockq(queue_t *q)
{
	int res;
	str_t *s = STR_PRIV(q);
	if (!(res = lis_spin_trylock(&s->qlock))) {
		if (q == s->iq)
			s->iwait = q;
		if (q == s->oq)
			s->owait = q;
	}
	return (res);
}
STATIC INLINE void ss7_unlockq(queue_t *q)
{
	str_t *s = STR_PRIV(q);
	lis_spin_unlock(&s->qlock);
	if (s->iwait) {
		if (s->iwait->q_qinfo && s->iwait->q_qinfo->qi_srvp)
			qenable(xchg(&s->iwait, NULL));
		else
			ss7_isrv(xchg(&s->iwait, NULL));
	}
	if (s->owait) {
		if (s->owait->q_qinfo && s->owait->q_qinfo->qi_srvp)
			qenable(xchg(&s->owait, NULL));
		else
			ss7_osrv(xchg(&s->iwait, NULL));
	}
}

#endif				/* __LOCK_H__ */


Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> strss7/drivers/lock.h

OpenSS7
SS7 for the
Common Man
Home Overview Status News Documentation Resources About

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified: