If by some miracle a segfault occurs in our program, I want to catch the SIGSEGV and let the user (possibly a GUI client) know with a single return code that a serious problem has occurred. At the same time I would like to display information on the command line to show which signal was caught.
Today our signal handler looks as follows...
In C I know about the recursive function but I heard about the re-entrant function.What is that? And whats the difference between them?
...
At the moment, I have some functions which look like this:
private bool inFunction1 = false;
public void function1()
{
if (inFunction1) return;
inFunction1 = true;
// do stuff which might cause function1 to get called
...
inFunction1 = false;
}
I'd like to be able to declare them like this:
[NoReEntry]
public vo...
The backgound: I am trying to forward the server-side ApplyChangeFailed event that is fired by a Sync Services for ADO 1.0 DBServerSyncProvider to the client. All the code examples for Sync Services conflict resolution do not use WCF, and when the client connects to the server database directly, this problem does not exist. My DBServerSy...
void reverse_string(char* string, int str_size) {
char tmp;
int i = 0;
int j = str_size - 1;
while (i < j) {
tmp = string[i];
string[i] = string[j];
string[j] = tmp;
++i;
--j;
}
}
I think this function is reentrant, since it doesn't use any global variable. It only modifies th...
My question refers to whether or not the use of a ReentrantLock guarantees visibility of a field in the same respect that the synchronized keyword provides.
For example, in the following class A, the field sharedData does not need to be declared volatile as the synchronized keyword is used.
class A
{
private double sharedData;
p...
In Java, do ReentrantLock.lock() and ReetrantLock.unlock() use the same locking mechanism as synchronized()?
My guess is "No," but I'm hoping to be wrong.
Example:
Imagine that Thread 1 and Thread 2 both have access to:
ReentrantLock lock = new ReentrantLock();
Thread 1 runs:
synchronized (lock) {
// blah
}
Thread 2 runs:
l...
Does GCC generate reentrant code for all scenarios ?
...
I can't find any information online how to pronounce this word.
...
Let's say I'm building a library to spork quuxes in C.
Quuxes need two state variables to be sporked successfully:
static int quux_state;
static char* quux_address;
/* function to spork quuxes found in a file,
reads a line from the file each time it's called. */
void spork_quux(FILE*);
If I store that data as global variables, o...
I have the following Perl code:
push(@myArray, $myValue);
Is the operation atomic, or will I need to use locks, if multiple threads will be performing this same operation on many threads?
...