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

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

1994/0808/sys/src/9/port/taslock.c:8,161995/0108/sys/src/9/port/taslock.c:8,35 (short | long | prev | next)
1992/0222    
void 
lock(Lock *l) 
{ 
1995/0108    
	int n; 
 
	if(up) { 
		n = up->inlock+2; 
		up->inlock = n; 
		if(tas(&l->key) == 0) 
			return; 
 
		for(;;){ 
			while(l->key) 
				if(conf.nproc == 1) { 
					up->yield = 1; 
					sched(); 
				} 
			up->inlock = n; 
			if(tas(&l->key) == 0) 
				return; 
		} 
	} 
 
1993/1204    
	if(tas(&l->key) == 0) 
		return; 
1994/0322    
                 
1993/0830    
	for(;;){ 
1994/0808    
		while(l->key) 
			; 
1994/0808/sys/src/9/port/taslock.c:52,581995/0108/sys/src/9/port/taslock.c:71,85
1992/0222    
void 
unlock(Lock *l) 
{ 
1995/0108    
	int n; 
 
1992/0222    
	l->key = 0; 
1995/0108    
	if(up) { 
		n = up->inlock-2; 
		if(n < 0) 
			n = 0; 
		up->inlock = n; 
	} 
1994/0322    
} 
 
void 


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