Skip to content

Commit 4ddff71

Browse files
committed
Fix: Make StreamStack thread-local to prevent cross-thread interference
Fixes #274 The StreamStack singleton was being shared globally across all threads, causing thread interference where one thread could see another thread'\''s active stream. This resulted in crashes when using cvcuda.Stream in multi-threaded applications. Solution: Changed the static singleton to thread_local static, ensuring each thread has its own StreamStack instance.
1 parent d45fa0a commit 4ddff71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/mod_cvcuda/nvcv/StreamStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ std::shared_ptr<Stream> StreamStack::top()
4848

4949
StreamStack &StreamStack::Instance()
5050
{
51-
static StreamStack stack;
51+
thread_local static StreamStack stack;
5252
return stack;
5353
}
5454

0 commit comments

Comments
 (0)