reentrancy

what is the difference between re-entrant function and recursive function in C?

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? ...

Can I add an attribute to a function to prevent reentry?

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...

Code Re-entrancy vs. Thread Safety

What is the difference between the concepts of "Code Re-entrancy" and "Thread Safety"? As per the link mentioned below, a piece of code can be either of them, both of them or neither of them. Reentrant and Thread safe code I was not able to understand the explaination clearly. Help would be appreciated. ...

.NET CF 2.0: possible single-threaded reentrancy

A simple application is written in CF 2.0. It's single-threaded as far as I'm concerned. Two parts of the application are of interest: an event handler that handles "Barcode scanned" event raised by a class that represents PDA's barcode scanner (provided by manufacturer), and an event handler for Windows.Forms.Timer that runs every 30 s...

Reentrancy was detected

I'm getting "Reentrancy was detected" MDA error while setting a webbrowser control's properties. This only happens if I call "SetWindowsHookEx" to hook some dials within the same thread. Normally this hooking code works fine but it doesn't play nice with Webbrowser Control. When I ignore the exception code works fine, at least look like...

Threadsafe vs re-entrant

Recently, I asked a question, with title as "Is malloc thread safe?", and inside that I asked, "Is malloc re-entrant?" I was under the impression that all re-entrant are thread-safe. Is this assumption wrong? ...

Reentrant locking.

A bit of help please, consider the bit of code below. public class Widget { public synchronized void doSomething() { ... } } public class LoggingWidget extends Widget { public synchronized void doSomething() { System.out.println(toString() + ": calling doSomething"); super.doSomething(); } } I ...

How to convince my co-worker the linux kernel code is re-entrant ?

Yeah I know ... Some people are sometimes hard to convince of what sounds natural to the rest of us, an I need your help right now SO community (or I'll go postal soon ..) One of my co-worker is convinced the linux kernel code is not re-entrant as he reads it somewhere last time he get insterested in it, likely 7 years ago. Probably its...

Future Protections in Managed Languages and Runtimes

In the future, will managed runtimes provide additional protections against subtle data corruption issues? Managed runtimes such as Java and the .NET CLR reduce or eliminate the possibility of many memory corruption bugs common in native languages like C#. Nonetheless, they are surprisingly not immune from all memory corruption problems...

[C#] Stopping timer in its callback method

I have a System.Threading.Timer that calls its appropriate event handler (callback) every 10 ms. The method itself is not reentrant and can sometimes take way longer than 10 ms. Thus, I want to stop the timer during method execution. Code: private Timer _creatorTimer; // BackgroundWorker's work private void CreatorWork(object sender, ...

Concurrent execution/Re-entrant /ThreadSafe/???

Hello, I read many answers given here for questions related to thread safety, re-entrancy, but when i think about them, some more questions came to mind, hence this question/s. 1.) I have one executable program say some *.exe. If i run this program on command prompt, and while it is executing, i run the same program on another command ...

Are recursive functions re-entrant

I have seen many recursive functions(mostly used in computing some mathematical operations e.g. factorial, sum of the digits in a number, etc...) which involve use of a static variable which holds the result of the each recursive call/operation, and uses it for the subsequent calls. So does that make recursive functions non-rentrant and...

What is a re-entrant parser?

Can someone explain this to me? In particular the difference between: http://github.com/whymirror/greg and http://piumarta.com/software/peg/ The former being a re-entrant version of the later. ...

How do I fix the "Reentrancy was detected" warning given by the Visual Studio debugger?

When running our unit tests in debug mode, at a certain point the Visual Studio debugger breaks to show the reentrancy MDA. The linked article explains that this occurs when A low-level operating system extensibility point, such as the vectored exception handler calls back into managed application code. Apparently this can cause heap co...

Writing re-entrant lexer with Flex

I'm newbie to flex. I'm trying to write a simple re-entrant lexer/scanner with flex. The lexer definition goes below. I get stuck with compilation errors as shown below (yyg issue): reentrant.l: /* Definitions */ digit [0-9] letter [a-zA-Z] alphanum [a-zA-Z0-9] identifier [a-zA-Z_][a-zA-Z0-9_]+ integer ...

What exactly is a reentrant function?

Most of the times, the definition of reentrance is quoted from Wikipedia: A computer program or routine is described as reentrant if it can be safely called again before its previous invocation has been completed (i.e it can be safely executed concurrently). To be reentrant, a computer program or routine: Must hol...

gcc and reentrant code

Does GCC generate reentrant code for all scenarios ? ...

Reentrancy and recursion

Would it be a true statement to say that every recursive function needs to be reentrant? ...

MySQL and PHP: Atomicity and re-entrancy of a PHP code block executing two subsequent queries - how dangerous?

In MySQL I have to check whether select query has returned any records, if not I insert a record. I am afraid though that the whole if-else operation in PHP scripts is NOT as atomic as I would like, i.e. will break in some scenarios, for example if another instance of the script is called where the same record needs to be worked with: i...

Threading and static methods in C#

Here is a meaningless extension method as an example: public static class MyExtensions { public static int MyExtensionMethod(this MyType e) { int x = 1; x = 2; return x } } Say a thread of execution completes upto and including the line: x = 2; The processor then context switches and another t...