Skip to content

Walking directory and limiting concurrency #3349

Answered by Darksonn
mrzv asked this question in Q&A
Discussion options

You must be logged in to vote

Put a Semaphore in an Arc to share it between all the tasks and acquire a new permit on the semaphore every time you open a file (but before opening it). If you make sure the permit is dropped after the file descriptor is closed, this will ensure that no more files are opened than there are permits in the semaphore.

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
5 replies
@mrzv
Comment options

@Darksonn
Comment options

@mrzv
Comment options

@Darksonn
Comment options

@mrzv
Comment options

Answer selected by mrzv
Comment options

You must be logged in to vote
4 replies
@Darksonn
Comment options

@mrzv
Comment options

@Darksonn
Comment options

@mrzv
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants