File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -79,19 +79,22 @@ erlfdb_future_cb(FDBFuture* fdb_future, void* data)
7979 // submitted to the network thread or not so that
8080 // we pass the correct environment to enif_send
8181 if (enif_thread_type () == ERL_NIF_THR_UNDEFINED ) {
82+ enif_mutex_lock (future -> lock );
8283 caller = NULL ;
8384 } else {
8485 caller = future -> pid_env ;
8586 }
8687
87- enif_mutex_lock ( future -> lock );
88+
8889
8990 if (!future -> cancelled ) {
9091 msg = T2 (future -> msg_env , future -> msg_ref , ATOM_ready );
9192 enif_send (caller , & (future -> pid ), future -> msg_env , msg );
9293 }
9394
94- enif_mutex_unlock (future -> lock );
95+ if (!caller ) {
96+ enif_mutex_unlock (future -> lock );
97+ }
9598
9699 // We're now done with this future which means we need
97100 // to release our handle to it. See erlfdb_create_future
You can’t perform that action at this time.
0 commit comments