critical-section Questions
2
I am writing code for a single processor 32 bit microcontroller using gcc.
I need to consume time-stamped objects from a linked list. Another part of the code which could be asynchronous (maybe in...
Langland asked 13/11, 2014 at 21:37
5
Solved
I am writing a program where there is an object shared by multiple threads:
A) Multiple write threads write to the object (all running the same
function)
B) A read thread which accesses the obje...
Malissamalissia asked 31/1, 2010 at 12:42
1
Solved
What's the best equivalent? I didn't find any reasonable solution for such a simple function. Choices I'm aware of:
1) MPEnterCriticalRegion - this is unfortunately extremely ineffective, probably...
Anticlastic asked 2/7, 2014 at 14:36
3
Solved
I have a stringlist myStringList with abouth 100 values and I'm doing asynchronous access to it.I would like to know if it is thread safe to do this :
currentIndex := myStringList.IndexOf(wantedVa...
Duhon asked 31/5, 2014 at 17:27
2
Solved
I have a webpage, in which a certain Ajax event is triggered asynchronously. This Ajax section could be called once or more than once. I do not have control over the number of times this event is t...
Lysander asked 3/3, 2014 at 15:41
5
Solved
Is there a faster kind of TMultiReadExclusiveWriteSynchronizer out there? FastCode perhaps?
Starting with Windows Vista, Microsoft added a Slim Reader/Writer lock. It performs much better than Del...
Angeli asked 30/4, 2012 at 3:49
2
Solved
I read somewhere that the overhead of a mutex is not that much, because the context switching only happens in case of contention.
Also known Futexes in Linux.
Does the same thing hold good in Win...
Jeffryjeffy asked 6/8, 2013 at 13:20
5
Solved
I have a bunch of threads. They should access a singleton containing configuration data which is initialized once when the singleton is created. Hence on the first access. So further actions on the...
Tocopherol asked 14/11, 2012 at 20:14
3
Solved
For example, would this be valid?
CRITICAL_SECTION cs;
::InitializeCriticalSection( &cs );
::EnterCriticalSection( &cs ); // First level
::EnterCriticalSection( &cs ); // Second leve...
Pecker asked 31/8, 2011 at 16:41
2
Solved
Here is what I need to do.
I hope dispatch_sync would be the best way to do it using GCD
I have a certain piece of critical section code that is placed in the applicationDidBecomeActive callback i...
Impinge asked 1/5, 2013 at 20:40
1
Solved
I recently learned that compilers will optimize your code by rearranging instructions, and that this can be controlled by using barriers.
IIRC, locking a mutex makes a barrier, and unlocking a mut...
Collocate asked 30/3, 2013 at 19:52
1
I am studying operating systems from Operating System Concepts by Silberschatz, Galvin, and Gagne.
On page 229, the book states this about Petersons Solution :
Because of the way modern ...
Venable asked 28/3, 2013 at 6:38
3
Is it possible to disable all interrupts with a ASM/C/C++ program to get full control about the processor?
If yes -> how?
If not -> how do "atomic" operation system calls work (for example enteri...
Casual asked 6/10, 2009 at 18:35
1
Solved
I would like to confirm here if I understood correctly how TCriticalSection and Synchronize operate.
As far as I know right now Synchronize uses SendMessage (update: or at least used it in older V...
Helban asked 3/12, 2012 at 13:22
5
Solved
I have come across C++03 some code that takes this form:
struct Foo {
int a;
int b;
CRITICAL_SECTION cs;
}
// DoFoo::Foo foo_;
void DoFoo::Foolish()
{
if( foo_.a == 4 )
{
PerformSomeTask()...
Shilling asked 30/11, 2012 at 18:16
1
Solved
We have some data structures that we are sharing across processes on Windows. (Via a shared data segment in a DLL that's loaded by all these processes.)
We need to synchronize some accesses and we...
Exegetics asked 23/11, 2012 at 15:46
3
Solved
I have two pieces of C++ code running on 2 different cores. Both of them write to the same file.
How to use OpenMP and make sure there is no crash?
Taeniacide asked 7/3, 2010 at 13:42
2
Solved
By default, a CRITICAL_SECTION object is recursive. Can this behaviour be configured like a pthread mutex to enable or disable recursive thread access?
To clarify in response to the comments: I am...
Abutter asked 29/10, 2012 at 7:46
1
Solved
I am hunting a possible deadlock in my program and im suspecting the following.
What happen if 2 threads at the same time calls EnterCriticalSection and thread #1 calls DeleteCriticalSection right ...
Jiva asked 8/10, 2012 at 1:49
2
Solved
I'm trying to add some debug checking for a CRITICAL_SECTION unlocking code, and I tried the following:
...
if (m_pCritSect) {
ASSERT(m_pCritSect->OwningThread == GetCurrentThreadId());
Leav...
Headwaiter asked 1/10, 2012 at 14:31
2
Solved
In attempting to create a thread-safe container class from scratch, I've run into the problem of returning values from access methods. For example in Windows:
myNode getSomeData( )
{
EnterCritica...
Mesotron asked 25/7, 2012 at 15:20
2
We have a problem with our application that is using a mixture of managed (C#) and unmanaged (C++) code. Basically we have a exe that invokes a bunch of assemblies and one of these assemblies is a ...
Chronological asked 15/2, 2012 at 7:49
1
Solved
I was reading about mutex,semaphores and critical sections. I understand that mutex synchronizes a resource so that only one thread accesses it at a time a semaphore allows a specific no of threads...
Micelle asked 4/5, 2012 at 21:21
6
Solved
This is from MSDN:
The lock keyword ensures that one thread does not enter a critical section of code while another thread is in the critical section.
Does a critical section have to be same as th...
Mannish asked 8/3, 2012 at 16:47
1
Solved
I am having an issue with a critical section in C++. I'm getting a hung window and when I dump the process I can see the thread waiting on a critical section:
16 Id: b10.b88 Suspend: 1 Teb: 7ffae...
Corrie asked 12/1, 2012 at 4:9
© 2022 - 2024 — McMap. All rights reserved.