mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	sync obj_to_id_tbl
objspace->obj_to_id_tbl is a shared table so we need to synchronize it to access.
This commit is contained in:
		
							parent
							
								
									7f11c8086a
								
							
						
					
					
						commit
						da3438a504
					
				
				
				Notes:
				
					git
				
				2020-12-17 18:14:04 +09:00 
				
			
			
			
		
		
					 1 changed files with 4 additions and 3 deletions
				
			
		
							
								
								
									
										5
									
								
								gc.c
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								gc.c
									
										
									
									
									
								
							|  | @ -4046,9 +4046,9 @@ cached_object_id(VALUE obj) | |||
|     VALUE id; | ||||
|     rb_objspace_t *objspace = &rb_objspace; | ||||
| 
 | ||||
|     RB_VM_LOCK_ENTER(); | ||||
|     if (st_lookup(objspace->obj_to_id_tbl, (st_data_t)obj, &id)) { | ||||
|         GC_ASSERT(FL_TEST(obj, FL_SEEN_OBJ_ID)); | ||||
|         return id; | ||||
|     } | ||||
|     else { | ||||
|         GC_ASSERT(!FL_TEST(obj, FL_SEEN_OBJ_ID)); | ||||
|  | @ -4061,10 +4061,11 @@ cached_object_id(VALUE obj) | |||
|         st_insert(objspace->id_to_obj_tbl, (st_data_t)id, (st_data_t)obj); | ||||
|         if (already_disabled == Qfalse) rb_objspace_gc_enable(objspace); | ||||
|         FL_SET(obj, FL_SEEN_OBJ_ID); | ||||
|     } | ||||
|     RB_VM_LOCK_LEAVE(); | ||||
| 
 | ||||
|     return id; | ||||
| } | ||||
| } | ||||
| 
 | ||||
| static VALUE | ||||
| nonspecial_obj_id_(VALUE obj) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Koichi Sasada
						Koichi Sasada