plan 9 kernel history: overview | file list | diff list

1995/1009/port/taslock.c (diff list | history)

1995/0110/sys/src/9/port/taslock.c:8,211995/1009/sys/src/9/port/taslock.c:8,33 (short | long | prev | next)
1992/0222    
void 
lock(Lock *l) 
{ 
1995/0110    
	if(tas(&l->key) == 0) 
1995/1009    
	int i; 
	ulong pc; 
 
	pc = getcallerpc(l); 
 
	if(tas(&l->key) == 0){ 
		l->pc = pc; 
1995/0110    
		return; 
1995/1009    
	} 
1995/0108    
 
1995/0110    
	for(;;){ 
1995/1009    
		i = 0; 
1995/0110    
		while(l->key) 
			; 
1995/0108    
		if(tas(&l->key) == 0) 
1995/1009    
			if(i++ > 10000000) 
				panic("lock loop key 0x%lux pc 0x%lux held by pc 0x%lux\n", 
					l->key, getcallerpc(l), l->pc); 
		if(tas(&l->key) == 0){ 
			l->pc = pc; 
1995/0108    
			return; 
1995/1009    
		} 
1995/0108    
	} 
1995/0110    
} 
1995/0108    
 
1995/0110/sys/src/9/port/taslock.c:23,321995/1009/sys/src/9/port/taslock.c:35,48
1995/0110    
ilock(Lock *l) 
{ 
	ulong x; 
1995/1009    
	ulong pc; 
1995/0110    
 
1995/1009    
	pc = getcallerpc(l); 
 
1995/0110    
	x = splhi(); 
	if(tas(&l->key) == 0){ 
		l->sr = x; 
1995/1009    
		l->pc = pc; 
1993/1204    
		return; 
1995/0110    
	} 
 
1995/0110/sys/src/9/port/taslock.c:35,401995/1009/sys/src/9/port/taslock.c:51,57
1994/0808    
			; 
1995/0110    
		if(tas(&l->key) == 0){ 
			l->sr = x; 
1995/1009    
			l->pc = pc; 
1992/0222    
			return; 
1995/0110    
		} 
1992/0222    
	} 
1995/0110/sys/src/9/port/taslock.c:46,511995/1009/sys/src/9/port/taslock.c:63,69
1992/0222    
	if(tas(&l->key)) 
		return 0; 
1995/0110    
 
1995/1009    
	l->pc = getcallerpc(l); 
1992/0222    
	return 1; 
} 
 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)