-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Argon can now evaluate code synchronously, specifically for eva…
…luating certain magic methods (e.g., comparison functions)
- Loading branch information
Showing
7 changed files
with
114 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// This source file is part of the Argon project. | ||
// | ||
// Licensed under the Apache License v2.0 | ||
|
||
#ifndef ARGON_VM_SYNC_MCOND_H_ | ||
#define ARGON_VM_SYNC_MCOND_H_ | ||
|
||
#include <condition_variable> | ||
#include <mutex> | ||
|
||
namespace argon::vm::sync { | ||
class MCond { | ||
std::mutex lock_; | ||
std::condition_variable cond_; | ||
|
||
public: | ||
void Notify() { | ||
this->cond_.notify_one(); | ||
} | ||
|
||
template<typename Predicate> | ||
void wait(Predicate pred) { | ||
std::unique_lock lck(this->lock_); | ||
this->cond_.wait(lck, pred); | ||
} | ||
}; | ||
|
||
} // namespace argon::vm::sync | ||
|
||
#endif // !ARGON_VM_SYNC_MCOND_H_ |