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

1991/0821/gnot/lock.c (diff list | history)

1991/0820/sys/src/9/gnot/lock.c:12,291991/0821/sys/src/9/gnot/lock.c:12,18 (short | long | prev | next)
1990/03091    
{ 
	int i; 
 
	/* 
	 * Try the fast grab first 
	 */ 
1991/0723    
    	if(tas(&l->key) == 0){ 
1991/0820    
		if(u) 
1991/0614    
			u->p->hasspin = 1; 
1991/0723    
		l->pc = ((ulong*)&l)[PCOFF]; 
1990/03091    
		return; 
	} 
1991/0820    
	for(i = 0; i < 100000; i++){ 
		if(u && u->p->state == Running) 
			sched(); 
1991/0821    
	for(i = 0; i < 1000000; i++){ 
1991/0723    
    		if (tas(&l->key) == 0){ 
1991/0820    
			if(u) 
1991/0614    
				u->p->hasspin = 1; 
1991/0820/sys/src/9/gnot/lock.c:30,351991/0821/sys/src/9/gnot/lock.c:19,26
1991/0723    
			l->pc = ((ulong*)&l)[PCOFF]; 
1990/03091    
			return; 
1990/0601    
		} 
1991/0821    
		if(u && u->p->state == Running) 
			sched(); 
1991/0723    
	} 
	i = l->key; 
	l->key = 0; 


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