开发者社区> 问答> 正文

如何实现自定义Model和Checker?

如何实现自定义Model和Checker?

展开
收起
游客hmzk6xi5mlygs 2022-05-12 14:38:40 415 0
1 条回答
写回答
取消 提交回答
  • (defrecord Mutex [locked?] Model (step [r op] (condp = (:f op) :acquire (if locked? "ERROR:已加锁仍可以抢到" (inconsistent "already held") (Mutex. true)) :release (if locked? (Mutex. false) "ERROR:未持有锁却可以释放" (inconsistent "not held"))))

    Object (toString [this] (if locked? "locked" "free")))

    "初始化时锁为释放状态" (defn mutex "A single mutex responding to :acquire and :release messages" [] (Mutex. false))

    2022-05-12 17:35:05
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
ui-model,跨框架复用 立即下载
NLP with MLlib--Global Empire Building for Fun and Profit 立即下载
A Developer’s View into Spark\'s Memory Model 立即下载