{"id":19600269,"url":"https://github.com/pharo-ide/readwritelock","last_synced_at":"2025-04-27T16:32:18.137Z","repository":{"id":55994286,"uuid":"97330881","full_name":"pharo-ide/ReadWriteLock","owner":"pharo-ide","description":"Implementation of reentral read write lock which described in https://en.wikipedia.org/wiki/Readers–writer_lock.","archived":false,"fork":false,"pushed_at":"2022-12-20T23:06:32.000Z","size":55,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T01:32:14.000Z","etag":null,"topics":["pharo","readwritelock","synchronization-primitives"],"latest_commit_sha":null,"homepage":null,"language":"Smalltalk","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pharo-ide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-15T17:14:18.000Z","updated_at":"2023-03-21T05:17:02.000Z","dependencies_parsed_at":"2023-01-30T02:15:46.504Z","dependency_job_id":null,"html_url":"https://github.com/pharo-ide/ReadWriteLock","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-ide%2FReadWriteLock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-ide%2FReadWriteLock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-ide%2FReadWriteLock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pharo-ide%2FReadWriteLock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pharo-ide","download_url":"https://codeload.github.com/pharo-ide/ReadWriteLock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251171614,"owners_count":21547120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pharo","readwritelock","synchronization-primitives"],"created_at":"2024-11-11T09:14:18.034Z","updated_at":"2025-04-27T16:32:17.774Z","avatar_url":"https://github.com/pharo-ide.png","language":"Smalltalk","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReadWriteLock\n\n[![GitHub release](https://img.shields.io/github/release/pharo-ide/ReadWriteLock.svg)](https://github.com/pharo-ide/ReadWriteLock/releases/latest)\n[![Unit Tests](https://github.com/pharo-ide/ReadWriteLock/actions/workflows/tests.yml/badge.svg)](https://github.com/pharo-ide/ReadWriteLock/actions/workflows/tests.yml)\n\n[![Pharo 7.0](https://img.shields.io/badge/Pharo-7.0-informational)](https://pharo.org)\n[![Pharo 8.0](https://img.shields.io/badge/Pharo-8.0-informational)](https://pharo.org)\n[![Pharo 9.0](https://img.shields.io/badge/Pharo-9.0-informational)](https://pharo.org)\n[![Pharo 10](https://img.shields.io/badge/Pharo-10-informational)](https://pharo.org)\n[![Pharo 11](https://img.shields.io/badge/Pharo-11-informational)](https://pharo.org)\n\nIt's implementation of reentral read write lock which described in \n[https://en.wikipedia.org/wiki/Readers–writer_lock](https://en.wikipedia.org/wiki/Readers–writer_lock). From the article:\n\n\u003e A ReadWriteLock allows concurrent access for read-only operations, while write operations require exclusive access. This means that multiple threads can read the data in parallel but an exclusive lock is needed for writing or modifying data. When a writer is writing the data, all other writers or readers will be blocked until the writer is finished writing.\n\n## Installation\n```Smalltalk\nMetacello new\n  baseline: 'ReadWriteLock';\n  repository: 'github://pharo-ide/ReadWriteLock';\n  load\n```\nUse following snippet for stable dependency in your project baseline:\n```Smalltalk\nspec\n    baseline: 'ReadWriteLock'\n    with: [ spec repository: 'github://pharo-ide/ReadWriteLock:v3.0.0' ]\n```\n## Public API and Key Messages:\n```Smalltalk\nlock := ReadWriteLock new.\nlock criticalRead: [\"read code\"].\nlock criticalWrite: [\"write code\"]\n```\nMain difficulty is carefully handle process termination during execution of critical sections. This problem described in Semaphore\u003e\u003ecritical: comment. Same approach is used here. But synchronization logic around two semaphores for reading and writing complicates things very much. No simple way to decompose logic on methods because information about process interruption become hidden.\u003c/br\u003e\nFrom Semaphore comment:\n\u003eThe main trick is assignment right before we go into the wait primitive (which is not a real send and therefore not interruptable either). So after we can check that waiting is happen or not.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpharo-ide%2Freadwritelock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpharo-ide%2Freadwritelock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpharo-ide%2Freadwritelock/lists"}