Skip to content

Commit

Permalink
Added lock_shard guard to keep_alive (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 authored Sep 28, 2024
1 parent 7fad726 commit c1bab7e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/nb_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ void keep_alive(PyObject *nurse, PyObject *patient) {
if (nb_type_check((PyObject *) Py_TYPE(nurse))) {
#if defined(NB_FREE_THREADED)
nb_shard &shard = internals->shard(inst_ptr((nb_inst *) nurse));
lock_shard guard(shard);
#else
nb_shard &shard = internals->shards[0];
#endif
Expand Down Expand Up @@ -1604,6 +1605,7 @@ void keep_alive(PyObject *nurse, void *payload,
if (nb_type_check((PyObject *) Py_TYPE(nurse))) {
#if defined(NB_FREE_THREADED)
nb_shard &shard = internals->shard(inst_ptr((nb_inst *) nurse));
lock_shard guard(shard);
#else
nb_shard &shard = internals->shards[0];
#endif
Expand Down

0 comments on commit c1bab7e

Please sign in to comment.