semaphore Questions
1
I use asyncio and aiohttp in my code, and it runs perfectly fine on my work laptop. However, when I run it on my virtual machine from my work laptop, I run into this error "The semaphore timeo...
Lop asked 6/3 at 16:1
1
C++20 std::atomic has wait and notify_* member functions, but no wait_for/wait_until.
The Microsoft STL implementation for std::atomic uses WaitOnAddress (when the OS is new enough to has it). And ...
3
Solved
I need two threads to progress in a "tick tock" pattern. When implmented with a semaphore this looks fine:
Semaphore tick_sem(1);
Semaphore tock_sem(0);
void ticker( void )
{
while( true )
{
P...
Bet asked 23/7, 2011 at 23:51
8
Is there such a thing as an atomic test-and-set, semaphore, or lock in Javascript?
I have javascript invoking async background processes via a custom protocol (the background process literally run...
Mara asked 17/2, 2009 at 0:51
6
Solved
How to interrupt all Cypress tests on the first test failure?
We are using semaphore to launch complete e2e tests with Cypress for each PR. But it takes too much time.
I'd like to interrupt all ...
Corrida asked 7/5, 2020 at 15:40
2
Solved
I'm late to the party, but I recently learned about SemaphoreSlim:
I used to use lock for synchronous locking, and a busy boolean for asynchronous locking. Now I just use SemaphoreSlim for everythi...
Imamate asked 21/11, 2022 at 17:39
18
Odd even number printing using thread I came across this question and wanted to discuss solution in C++ . What I can think of using 2 binary semaphores odd and even semaphore. even semaphore initia...
Hypha asked 1/2, 2013 at 6:48
8
Solved
Is there any advantage of using
java.util.concurrent.CountdownLatch
instead of
java.util.concurrent.Semaphore?
As far as I can tell the following fragments are almost equivalent:
1. Semaphor...
Marasmus asked 8/10, 2008 at 18:25
4
Solved
Here is the code I have but I don't understand what SemaphoreSlim is doing.
async Task WorkerMainAsync()
{
SemaphoreSlim ss = new SemaphoreSlim(10);
List<Task> trackedTasks = new List<Ta...
Confine asked 18/11, 2013 at 20:2
37
Is there any difference between a binary semaphore and mutex or are they essentially the same?
Misspend asked 15/9, 2008 at 13:23
7
Some time ago had an interview and was asked to implement
Semaphore by using mutex operations and primitives only
(he allowed int to be considered as atomic). I came with solution below.
He did not...
13
Solved
How do i tell if one instance of my program is running?
I thought I could do this with a data file but it would just be messy :(
I want to do this as I only want 1 instance to ever be open at one ...
Nez asked 19/1, 2009 at 23:7
3
Solved
I know that threading.Lock() is equal to threading.Semaphore(1).
Is also threading.Lock() equal to threading.BoundedSemaphore(1) ?
And newly I saw threading.BoundedSemaphore(), what is the differen...
Levey asked 25/2, 2018 at 7:8
10
Solved
I am trying to port a project (from linux) that uses Semaphores to Mac OS X however some of the posix semaphores are not implemented on Mac OS X
The one that I hit in this port is sem_timedwait()
...
3
I'm a little confused by the Linux API sem_unlink(), mainly when or why to call it. I've used semaphores in Windows for many years. In Windows once you close the last handle of a named semaphore th...
2
Solved
I am using RSemaphore to maintain a particular count. Please take a look below:-
RSemaphore sem = redisson.getSemaphore("custid=10");
sem.trySetPermits(10);
try {
sem.acquire();
} catch (Interr...
Caltrop asked 23/8, 2018 at 9:46
2
Solved
I am trying to limit the number of simultaneous async functions running using a semaphore, but I cannot get it to work. My code boils down to this:
import asyncio
async def send(i):
print(f&quo...
Essex asked 20/3, 2021 at 18:2
3
Solved
I need to do some process synchronization in C. I want to use a monitor, and I have read a lot about them. However I have been unable to find out how to implement one in C. I have seen them done in...
7
Solved
I'm working on an implementation of the "Fair Barbershop" problem in Ruby. This is for a class assignment, but I'm not looking for any handouts. I've been searching like crazy, but I cannot seem to...
5
Solved
I have few methods that report some data to Data base. We want to invoke all calls to Data service asynchronously. These calls to data service are all over and so we want to make sure that these DS...
Electrodeposit asked 2/4, 2020 at 4:12
3
Solved
I'm extending the functionality of a semaphore. I ran into a roadblock when I realized I don't know the implementation of an actual semaphore and to make sure my code ran correctly, I needed to kno...
Elongation asked 24/3, 2009 at 20:22
10
http://msdn.microsoft.com/en-us/library/system.threading.semaphoreslim.aspx
To create a semaphore, I need to provide an initial count and maximum count. MSDN states that an initial count is -
The ...
Disinfect asked 16/1, 2011 at 17:3
7
I'm getting this error...
The semaphore timeout period has expired.
On this line...
ThePorts.ActivePort1.Open();
...but I only get it from time to time. When it happens, it happens over a...
Stella asked 22/12, 2012 at 2:7
6
I've started programming in Python a few weeks ago and was trying to use Semaphores to synchronize two simple threads, for learning purposes. Here is what I've got:
import threading
sem = threading...
Capriola asked 20/7, 2015 at 3:48
3
Solved
When I run this code in Python 3.7:
import asyncio
sem = asyncio.Semaphore(2)
async def work():
async with sem:
print('working')
await asyncio.sleep(1)
async def main():
await asyncio.gathe...
Bertelli asked 30/4, 2019 at 9:38
1 Next >
© 2022 - 2024 — McMap. All rights reserved.