Skip to content

Commit

Permalink
Fix BEAM crash from from port/NIF thread
Browse files Browse the repository at this point in the history
  • Loading branch information
dotsimon committed Mar 1, 2024
1 parent b6c6537 commit d2e8b15
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions erts/emulator/beam/erl_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -2942,9 +2942,14 @@ ERTS_GLB_INLINE
Uint32 erts_sched_local_random(Uint additional_seed)
{
ErtsSchedulerData *esdp = erts_get_scheduler_data();
esdp->rand_state++;
return erts_sched_local_random_hash_64_to_32_shift(esdp->rand_state
+ additional_seed);
if(ERTS_UNLIKELY(esdp == NULL))
return erts_sched_local_random_hash_64_to_32_shift(((Uint64)(UWord)&additional_seed)
+ additional_seed);
else {
esdp->rand_state++;
return erts_sched_local_random_hash_64_to_32_shift(esdp->rand_state
+ additional_seed);
}
}

#ifdef DEBUG
Expand Down

0 comments on commit d2e8b15

Please sign in to comment.