Inmanual mode you have already locked the exposure through aperture and shutter speed settings. As you point the camera at different parts of the scene nothing changes since you have set the exposure.
As an example, suppose you want to shoot a person silouetted against a bright background but with the person appearing at the side of the image. So you aim the camera at the person, adjust aperture and shutter speed, then recompose and shoot. There is no need for an AE lock.
In the above example, if you have the camera in auto mode, you aim at the person, hold the release button half way, then recompose. But the camera's exposure settings will change as you recompose. To prevent that, you hold in the AE lock button while recomposing.
When shooting outdoors, I find I have to manually set exposure only once. Unless the lighting conditions change dramatically, I don't have to readjust more than one stop or so. Also, most outdoor shots are focussed at infinity, so I just leave my manual focus lens set there. The camera then becomes a very reliable point and shoot.
Once you have metered to your desired exposure and dialed in your exposure settings in Manual Mode, say 1/500 @ f/8, you may feel like increasing depth of field to f/22. However, now you're going to ALSO have to adjust your shutter speed, in this case to 1/60. And you'll have to think about this as your meter may be diddling as light shines through trees, etc. and even more so if you're using a metering that's not at zero. This is particularly painful with single-dial cameras like my D5100 where an additional button must be pressed to access aperture adjustment.
Frankly, it is quite amazing to me that Nikon has failed to grasp this very simple concept for SO SO long. It is as ridiculous as Nikon's other shortcoming with flash compensation limited to +1 stop. WHY? And also as totally ridiculous as being in Manual Mode with Auto ISO and not being able to use Exposure Compensation. Well, you can dial in EC, but you won't GET any. You can dial in -5 stops or +5 stops if you like but you will get what the camera considers to be zero. Totally ridiculous that you CAN'T set aperture, shutter speed and compensation with Auto ISO to get your desired result. Nikon REALLY needs to start waking up and firing a bunch of people in their design team(s)... These shortcomings, along with Nikon just getting destroyed in DSLR video by Canon is making me seriously consider selling off my extensive decades-long collection of Nikon cameras and lenses and making the move to Canon once and for all.
But just doing the locking and unlocking manually will be much better.
How can I manually lock and unlock just like the lock(object) does? I need it to use same interface as lock so that this manual way and lock will block each other (for more complex cases).
Thomas suggests double-checked locking in his answer. This is problematic. First off, you should not use low-lock techniques unless you have demonstrated that you have a real performance problem that is solved by the low-lock technique. Low-lock techniques are insanely difficult to get right.
Third, as I pointed out in a comment above, it seems crazy to return that the _DoSomething is "done" when another thread is in fact still in the process of doing it. I don't understand why you have that requirement, and I'm going to assume that it is a mistake. The problems with this pattern still exist even if we set "done" after "_DoSomething" does its thing.
Is this threadsafe in all possible implementations of C#? I don't think it is. Remember, non-volatile reads may be moved around in time by the processor cache. The C# language guarantees that volatile reads are consistently ordered with respect to critical execution points like locks, and it guarantees that non-volatile reads are consistent within a single thread of execution, but it does not guarantee that non-volatile reads are consistent in any way across threads of execution.
On thread Bravo, the processor cache happens to do a (non-volatile!) fetch of the memory location for x, which contains zero. "done" happens to be on a different page of memory which is not fetched into the cache quite yet.
On thread Alpha at the "same time" on a different processor DoIt calls DoSomething. Thread Alpha now runs everything in there. When thread Alpha is done its work, done is true and x is 123 on Alpha's processor. Thread Alpha's processor flushes those facts back out to main memory.
So now "done" is true, but "x" is still zero in the processor cache for thread Bravo. Thread Bravo is not required to invalidate the portion of the cache that contains "x" being zero because on thread Bravo neither the read of "done" nor the read of "x" were volatile reads.
The proposed version of double-checked locking is not actually double-checked locking at all. When you change the double-checked locking pattern you need to start over again from scratch and re-analyze everything.
The way to make this version of the pattern correct is to make at least the first read of "done" into a volatile read. Then the read of "x" will not be permitted to move "ahead" of the volatile read to "done".
If the other threads don't need to wait for the operation to complete, the second code snippet in your question would work fine. You can optimize it further by eliminating your lock entirely and using an atomic operation instead:
Because I came into a similar problem, but several function calls can be needed, which should be decided on inside the lock block, but should be executed after unlocking, I implemented a rather general approach:
I have a ubolt pro wifi with auto lock issues.
It worked fine for some time but not only works sporadically. If opened manually from the inside it will not auto lock when door is closed (the sensor does pick up that the door is closed and not open). It will close it opened using code or fingerprint from the outside.
It works once immediately after resetting the auto lock in the app or reinstalling the sensor, but stops working immediately after the first attempt.
U-Tec CSR acknowledged an issue in this thread back on April 21 - more than 2 months ago! My firmware has been up to date all along, and the problem persists. This is a critical bug that should be patched in well under 8 weeks.
Same lock behavior as Mike9. Auto lock worked great for several months. A few weeks ago started noticing the following behavior would sometimes occur, but not always. Manually unlocked door from inside, went outside, returned from walk 30 minutes later, door was still unlocked. Firmware is current.
This is now happening to me after about a month of working. Absolutely deal breaker when the lock you buy to add protection ends up leaving you more vulnerable. Total fail and there is no way I can trust UTEC moving forward
Exact same issue hear with auto lock not working all of a sudden. Has to be reset in the app or a power cycle with batteries but seems to stop working again when you manually unlock from inside. Massive issue as it is the main means to exiting from inside.
Mine does the same thing but it appears to be somewhat intermittent. At times, the inside knob appears to operate the deadbolt without resistance. Usually, I feel motor/mechanism resistance as I approach the end of the knob rotation (both locking and unlocking). I have had some success locking and unlocking manually from the outside (with the key) but still feel the lock motor fighting me, just as it does when using the interior knob.
No offense to anybody in the Wyze community or any other company for that matter, but there is no way in the world I am trusting a third party WiFi product to lock or unlock the door to my valued property. Too many things can go wrong turning this product into a disaster.
I updated my support ticket with this information, and was not offered any other advice, was only offered a refund or exchange. I am requesting and exchange, as I would really like this thing to work as it seems to for many other customers.
I still have faith in Wyze, ordered the scale and watch today. I have all your products. I do need to find some time to figure out how to see why I only receive event notifications one of my IOS devices, instead of all them.
For the automatic targeting to work, and using manual fire, you need AI in the gunners seat or a player in the gunners seat (however with a player you wont have an option to manual fire). The only reason I could guess for the reason behind this is because the firing computer is in the gunners seat, hence having a need for a body in the gunners seat.
I've never tried to fly any of the attack helis from the gunners seat, do they even have flight controls? *Side note* I know the Apache has flight controls in both cockpits and the gunner is considered a weapons officer and a co-pilot. The Blackfoot aka Comanche gunner does not have flight controls, I had to check a YouTube vid (I'm @ work). Just checked the Kajman as well, the gunner does not have flight controls...
Personally, I use the gunner seat and take controls (Scroll menu.. it's there unless someone enters the chopper with you)... It's easier to solo if you're from the gunner because then you get the scope too.
As for "I can't lock onto targets", you need to hold right click pretty much right on top of them from the cockpit view. If they're picking up on the radar, you can hit TAB and generally pick them up.
That doesn't make any sense.. that sounds like balancing in the game (the devs don't want players to effectively kill enemies when flying attack heli alone) and this game shouldn't contain such stuff.
Don't know how that would be possible when you have to aim exactly at the vehicle until you can lock on it, that would be very, very hard from 2-3 km away, but on the other hand i yet haven't tested that alone, i will try that and report back.
3a8082e126