Leave GC collection to the user of the D library?
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sun May 9 11:03:33 UTC 2021
On Sunday, 9 May 2021 at 10:42:19 UTC, Ola Fosheim Grøstad wrote:
> semaphore hits 0 all pipes are in use, and the calling thread
> will wait in the API stub (wrapper function) until a worker
> thread is available? Kinda clunky, but fits your model... I
> guess.
So I imagine you could structure your API wrapper something like
this:
semaphore.init(N)
wrapped_api_call(){
semaphore.down(1)
dostuff()
api_call()
semaphore.up(1)
if (memory pressure){
semaphore.down(N)
gc_collect()
semaphore.up(N)
}
}
I dunno.
More information about the Digitalmars-d
mailing list