We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 22f5324 commit 3b10d80Copy full SHA for 3b10d80
1 file changed
c_src/main.c
@@ -79,19 +79,22 @@ erlfdb_future_cb(FDBFuture* fdb_future, void* data)
79
// submitted to the network thread or not so that
80
// we pass the correct environment to enif_send
81
if(enif_thread_type() == ERL_NIF_THR_UNDEFINED) {
82
+ enif_mutex_lock(future->lock);
83
caller = NULL;
84
} else {
85
caller = future->pid_env;
86
}
87
- enif_mutex_lock(future->lock);
88
+
89
90
if(!future->cancelled) {
91
msg = T2(future->msg_env, future->msg_ref, ATOM_ready);
92
enif_send(caller, &(future->pid), future->msg_env, msg);
93
94
- enif_mutex_unlock(future->lock);
95
+ if (!caller) {
96
+ enif_mutex_unlock(future->lock);
97
+ }
98
99
// We're now done with this future which means we need
100
// to release our handle to it. See erlfdb_create_future
0 commit comments