Semaphore

版本 1.2.0.0 (1.4 KB) 作者: Kevin Wang
Simple semaphore implementation wrapping around Matlab's waitfor.
748.0 次下载
更新时间 2013/8/9

查看许可证

Matlab has a waitfor function but it only works if you have a figure handle, leading to some somewhat out-of-place code if you want to use it with callbacks.

Semaphore.m is a simple wrapper around waitfor to make downstream code a little cleaner. To use it, create a Semaphore object. If this object is passed to an event handler or timer, then that handler can call Semaphore.Release() when it's finished.

If another thread as a Semaphore.Wait() call, it will wait until the respective Semaphore has been released.

Inspired by http://www.mathworks.com/matlabcentral/fileexchange/32489-semaphore, but I wanted something that didn't require an external library.

引用格式

Kevin Wang (2025). Semaphore (https://ww2.mathworks.cn/matlabcentral/fileexchange/42910-semaphore), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2013a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Develop Apps Using App Designer 的更多信息
致谢

参考作品: semaphore

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.2.0.0

Removed eval() calls.

1.1.0.0

Updated to reuse existing figures to save memory and improve performance.

1.0.0.0