mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 21:10:30 +00:00
Merge pull request #3326 from rick-masters/fix_fields_wait_signal
Fix fields_wait_signal futex.
This commit is contained in:
@@ -3393,6 +3393,7 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
elem->Struct.tags = gb_alloc_array(permanent_allocator(), String, fields.count);
|
||||
elem->Struct.node = dummy_node_struct;
|
||||
type_set_offsets(elem);
|
||||
wait_signal_set(&elem->Struct.fields_wait_signal);
|
||||
}
|
||||
|
||||
Type *soa_type = make_soa_struct_slice(c, dummy_node_soa, nullptr, elem);
|
||||
@@ -3766,6 +3767,7 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
soa_struct->Struct.tags[i] = old_struct->Struct.tags[i];
|
||||
}
|
||||
}
|
||||
wait_signal_set(&soa_struct->Struct.fields_wait_signal);
|
||||
|
||||
Token token = {};
|
||||
token.string = str_lit("Base_Type");
|
||||
|
||||
@@ -8878,6 +8878,7 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast *
|
||||
break;
|
||||
}
|
||||
|
||||
wait_signal_until_available(&t->Struct.fields_wait_signal);
|
||||
isize field_count = t->Struct.fields.count;
|
||||
isize min_field_count = t->Struct.fields.count;
|
||||
for (isize i = min_field_count-1; i >= 0; i--) {
|
||||
|
||||
@@ -2491,6 +2491,7 @@ gb_internal Type *get_map_cell_type(Type *type) {
|
||||
s->Struct.fields[0] = alloc_entity_field(scope, make_token_ident("v"), alloc_type_array(type, len), false, 0, EntityState_Resolved);
|
||||
s->Struct.fields[1] = alloc_entity_field(scope, make_token_ident("_"), alloc_type_array(t_u8, padding), false, 1, EntityState_Resolved);
|
||||
s->Struct.scope = scope;
|
||||
wait_signal_set(&s->Struct.fields_wait_signal);
|
||||
gb_unused(type_size_of(s));
|
||||
|
||||
return s;
|
||||
@@ -2521,6 +2522,7 @@ gb_internal void init_map_internal_types(Type *type) {
|
||||
metadata_type->Struct.fields[4] = alloc_entity_field(metadata_scope, make_token_ident("value_cell"), value_cell, false, 4, EntityState_Resolved);
|
||||
metadata_type->Struct.scope = metadata_scope;
|
||||
metadata_type->Struct.node = nullptr;
|
||||
wait_signal_set(&metadata_type->Struct.fields_wait_signal);
|
||||
|
||||
gb_unused(type_size_of(metadata_type));
|
||||
|
||||
@@ -2538,6 +2540,7 @@ gb_internal void init_map_internal_types(Type *type) {
|
||||
debug_type->Struct.fields[3] = alloc_entity_field(scope, make_token_ident("__metadata"), metadata_type, false, 3, EntityState_Resolved);
|
||||
debug_type->Struct.scope = scope;
|
||||
debug_type->Struct.node = nullptr;
|
||||
wait_signal_set(&debug_type->Struct.fields_wait_signal);
|
||||
|
||||
gb_unused(type_size_of(debug_type));
|
||||
|
||||
@@ -2833,6 +2836,7 @@ gb_internal Type *make_soa_struct_internal(CheckerContext *ctx, Ast *array_typ_e
|
||||
add_entity(ctx, scope, nullptr, base_type_entity);
|
||||
|
||||
add_type_info_type(ctx, soa_struct);
|
||||
wait_signal_set(&soa_struct->Struct.fields_wait_signal);
|
||||
|
||||
return soa_struct;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ struct Wait_Signal {
|
||||
|
||||
gb_internal void wait_signal_until_available(Wait_Signal *ws) {
|
||||
if (ws->futex.load() == 0) {
|
||||
futex_wait(&ws->futex, 1);
|
||||
futex_wait(&ws->futex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user