You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would allow to simply and safely queue tasks for processing while making sure that acquired tokens are never lost:
constsem=newSema(3);// Run many task in parallel limited by semfor(leti=0;i<100;i++){sem.runTask(async()=>{// do some stuff});}// Alternatively use Promise.all and mapawaitPromise.all(items.map(item=>sem.runTask(()=>processItem(item))))
The text was updated successfully, but these errors were encountered:
I think adding the following utility function might simplify working with semaphores a lot
It would allow to simply and safely queue tasks for processing while making sure that acquired tokens are never lost:
The text was updated successfully, but these errors were encountered: