Skip to content

Commit

Permalink
Fix xtd::native::condition_variable::create method on linux and macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Sep 14, 2023
1 parent aaf64e6 commit 9816710
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

intmax_t condition_variable::create() {
pthread_cond_t* handle = new pthread_cond_t;
if (handle == nullptr) return reinterpret_cast<intmax_t>(MUTEX_FAILED);
if (pthread_cond_init(handle, nullptr) != 0) {
delete handle;
return reinterpret_cast<intmax_t>(MUTEX_FAILED);
}
return reinterpret_cast<intmax_t>(handle);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ using namespace xtd::native;

intmax_t condition_variable::create() {
pthread_cond_t* handle = new pthread_cond_t;
if (handle == nullptr) return reinterpret_cast<intmax_t>(MUTEX_FAILED);
if (pthread_cond_init(handle, nullptr) != 0) {
delete handle;
return reinterpret_cast<intmax_t>(MUTEX_FAILED);
}
return reinterpret_cast<intmax_t>(handle);
}

Expand Down

0 comments on commit 9816710

Please sign in to comment.