Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best match in C# to Java ReentrantLock and Condition?

Another cross-language question: can someone tell me what C# Threading constructs best match the Java ReentrantLock and Condition classes? ReentrantLock has lockInterruptibly() and unlock() methods, while Condition has signal() and await() methods. It is this combination that I would like to be able to preserve in the C# code - or something similar... Thanks in advance.

like image 780
Paul Morrison Avatar asked Mar 05 '09 20:03

Paul Morrison


People also ask

What is the pattern matching in C?

Pattern matching in C− We have to find if a string is present in another string, as an example, the string "algorithm” is present within the string "naive algorithm". If it is found, then its location (i.e. position it is present at) is displayed.

Can I use regex in C?

A regular expression is a sequence of characters used to match a pattern to a string. The expression can be used for searching text and validating input. Remember, a regular expression is not the property of a particular language. POSIX is a well-known library used for regular expressions in C.

How function calls are matched with overloaded functions?

When a function call is made to an overloaded function, the compiler steps through a sequence of rules to determine which (if any) of the overloaded functions is the best match. At each step, the compiler applies a bunch of different type conversions to the argument(s) in the function call.

What is function overloading write the steps to find unique match during compilation?

Function Overloading in C++When a function name is overloaded with different jobs it is called Function Overloading. In Function Overloading “Function” name should be the same and the arguments should be different. Function overloading can be considered as an example of a polymorphism feature in C++.


1 Answers

I think what you're looking for is the static Monitor class. I allows for blocking and non-blocking mutex acquisition, as well as condition variable operations. (They call them Pulse, PulseAll and Wait rather than signal and await).

like image 116
Ben S Avatar answered Sep 23 '22 01:09

Ben S