Deprecated: Creation of dynamic property wpdb::$categories is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 668
Deprecated: Creation of dynamic property wpdb::$post2cat is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 668
Deprecated: Creation of dynamic property wpdb::$link2cat is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 668
Deprecated: Return type of WP_Theme::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 554
Deprecated: Return type of WP_Theme::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 595
Deprecated: Return type of WP_Theme::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 535
Deprecated: Return type of WP_Theme::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-theme.php on line 544
Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /usr/home/bugyo/public_html/b-log/wp-includes/comment-template.php on line 1739
Deprecated: Return type of WP_REST_Request::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 960
Deprecated: Return type of WP_REST_Request::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 980
Deprecated: Return type of WP_REST_Request::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 992
Deprecated: Return type of WP_REST_Request::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-request.php on line 1003
Deprecated: Return type of WP_Block_List::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 151
Deprecated: Return type of WP_Block_List::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 175
Deprecated: Return type of WP_Block_List::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 164
Deprecated: Return type of WP_Block_List::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 186
Deprecated: Return type of WP_Block_List::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 138
Deprecated: Return type of WP_Block_List::offsetExists($index) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 75
Deprecated: Return type of WP_Block_List::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 89
Deprecated: Return type of WP_Block_List::offsetSet($index, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 110
Deprecated: Return type of WP_Block_List::offsetUnset($index) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 127
Deprecated: Return type of WP_Block_List::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php on line 199
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/home/bugyo/public_html/b-log/wp-includes/wp-db.php on line 3030
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
Warning: Cannot modify header information - headers already sent by (output started at /usr/home/bugyo/public_html/b-log/wp-includes/class-wp-block-list.php:14) in /usr/home/bugyo/public_html/b-log/wp-includes/rest-api/class-wp-rest-server.php on line 1642
{"id":799,"date":"2011-11-09T21:15:18","date_gmt":"2011-11-09T12:15:18","guid":{"rendered":"http:\/\/blog.bugyo.tk\/b-log\/?p=799"},"modified":"2012-08-26T21:35:38","modified_gmt":"2012-08-26T12:35:38","slug":"%e4%b8%a6%e8%a1%8c%e8%a8%88%e7%ae%97schemeracket-srfi-18%e3%81%aemutex%e3%81%a8condition-variable","status":"publish","type":"post","link":"https:\/\/blog.bugyo.tk\/b-log\/archives\/799","title":{"rendered":"[\u4e26\u884c\u8a08\u7b97][Scheme][Racket] SRFI 18\u306emutex\u3068condition variable"},"content":{"rendered":"Racket\u306fSRFI 18\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u306a\u3063\u3066\u3044\u308b\u304c\u3001mutex-lock!\u3084condition-variable-signal!\u306a\u3069\u3069\u306e\u624b\u7d9a\u304d\u306frequire\u3057\u3066\u3082\u5b9a\u7fa9\u3055\u308c\u306a\u3044\u3002<\/p>\n
mutex\u3084condition variable\u306e\u3088\u3046\u306a\u540c\u671f\u6a5f\u69cb\u3067\u306f\u306a\u304f\u3001\u30c1\u30e3\u30cd\u30eb\u901a\u4fe1\u306a\u3069\u306e\u6a5f\u69cb\u3092\u4f7f\u3048\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3060\u3068\u601d\u3046\u304c\u3001\u30ed\u30c3\u30af\u3092\u4f7f\u3063\u305f\u307b\u3046\u304c\u7d20\u76f4\u306b\u5b9f\u88c5\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308b\u3002<\/p>\n
\u5e78\u3044\u30bb\u30de\u30d5\u30a9\u306f\u3042\u308b\u3088\u3046\u306a\u306e\u3067\u3001\u30bb\u30de\u30d5\u30a9\u3067mutex\u3084condition variable\u3092\u6b21\u306e\u3088\u3046\u306b\u66f8\u3044\u305f\u3002<\/p>\n
\r\n;;; mutex\r\n(define (make-mutex)\r\n (make-semaphore 1))\r\n\r\n(define (mutex-lock! m)\r\n (semaphore-wait m))\r\n\r\n(define (mutex-unlock-primitive! m)\r\n (semaphore-post m))\r\n\r\n(define (mutex-unlock! m . rest)\r\n (let ((condvar (if (null? rest) #f (car rest))))\r\n (mutex-unlock-primitive! m)\r\n (when condvar\r\n (condition-variable-wait! condvar))))\r\n\r\n;;; gate\r\n(define (make-gate)\r\n (make-semaphore 0))\r\n\r\n(define (gate-wait! g)\r\n (semaphore-wait g))\r\n\r\n(define (gate-signal! g)\r\n (semaphore-post g))\r\n\r\n;;; condition variable\r\n(define (make-condition-variable)\r\n (list 'condition-variable '() (make-mutex)))\r\n\r\n(define (condition-variable-gates cv)\r\n (list-ref cv 1))\r\n\r\n(define (condition-variable-mutex cv)\r\n (list-ref cv 2))\r\n\r\n(define (condition-variable-clear-gates! cv)\r\n (set-car! (cdr cv) '() ))\r\n\r\n(define (condition-variable-put-gates! cv val)\r\n (set-car! (cdr cv)\r\n\t (cons val (condition-variable-gates cv))))\r\n\r\n(define (condition-variable-wait! cv)\r\n (let ((mutex (condition-variable-mutex cv))\r\n\t(gates (condition-variable-gates cv))\r\n\t(new-gate (make-gate)))\r\n (mutex-lock! mutex)\r\n (condition-variable-put-gates! cv new-gate)\r\n (mutex-unlock-primitive! mutex)\r\n (gate-wait! new-gate)))\r\n\r\n(define (condition-variable-signal! cv)\r\n (let ((mutex (condition-variable-mutex cv))\r\n\t(gates (condition-variable-gates cv)))\r\n (mutex-lock! mutex)\r\n (for-each (lambda (g) (gate-signal! g))\r\n\t\tgates)\r\n (condition-variable-clear-gates! cv)\r\n (mutex-unlock-primitive! mutex)))<\/pre>\ncondition variable\u306f\u4f7f\u3044\u6368\u3066\u306emutex\u3092\u7528\u3044\u3066\u5b9f\u88c5\u3057\u3066\u3044\u308b\u3002
\n\u3053\u308c\u3067\u3001\u540c\u671f\u306b\u95a2\u3057\u3066SRFI 18\u3067\u5b9a\u3081\u3089\u308c\u305f\u624b\u7d9a\u304d\u304c\u4f7f\u3048\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Racket\u306fSRFI 18\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u306a\u3063\u3066\u3044\u308b\u304c\u3001mutex-lock!\u3084condition-variable-signal!\u306a\u3069\u3069\u306e\u624b\u7d9a\u304d\u306frequire\u3057\u3066\u3082\u5b9a\u7fa9\u3055\u308c\u306a\u3044\u3002 mutex\u3084condition variable\u306e\u3088\u3046\u306a\u540c\u671f\u6a5f\u69cb\u3067\u306f\u306a\u304f\u3001\u30c1\u30e3\u30cd\u30eb\u901a\u4fe1\u306a\u3069\u306e\u6a5f\u69cb\u3092\u4f7f\u3048\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3060\u3068\u601d\u3046\u304c\u3001\u30ed\u30c3\u30af\u3092\u4f7f\u3063\u305f\u307b\u3046\u304c\u7d20\u76f4\u306b\u5b9f\u88c5\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308b\u3002 \u5e78\u3044\u30bb\u30de\u30d5\u30a9\u306f\u3042\u308b\u3088\u3046\u306a\u306e\u3067\u3001\u30bb\u30de\u30d5\u30a9\u3067mutex\u3084condition variable\u3092\u6b21\u306e\u3088\u3046\u306b\u66f8\u3044\u305f\u3002 ;;; mutex (define (make-mutex) (make-semaphore 1)) (define (mutex-lock! m) (semaphore-wait m)) (define (mutex-unlock-primitive! m) (semaphore-post m)) (define (mutex-unlock! m . rest) (let ((condvar (if (null? rest) #f (car rest)))) (mutex-unlock-primitive! m) (when condvar (condition-variable-wait! Continue reading [\u4e26\u884c\u8a08\u7b97][Scheme][Racket] SRFI 18\u306emutex\u3068condition variable<\/span>→<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[274,275,268,236,278,277,276],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts\/799"}],"collection":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/comments?post=799"}],"version-history":[{"count":11,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts\/799\/revisions"}],"predecessor-version":[{"id":803,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/posts\/799\/revisions\/803"}],"wp:attachment":[{"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/media?parent=799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/categories?post=799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bugyo.tk\/b-log\/wp-json\/wp\/v2\/tags?post=799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}