Comments (8)
The first thing that comes to mind with notification is that you'd naturally have cross-thread issues (why else have a lock?).
I can see merit in the idea but there'd have to be warnings for people to not rely on it as a "this lock is available" because race conditions, yada yada :)
Nothing that can't be solved with a bit of documentation I suppose :)
from asyncex.
I agree with your comment about the race condition. However I don't see any other way to notify a button that it needs to disable itself when the critical section has been entered.. If there is some other way to do it then please let me know. I do think we need to be able to notify the UI that a critical section is active / locked.
I also agree with the cross-thread comment, although I would say this is kind of a "normal" problem.
from asyncex.
The IsTaken
is being considered as part of the new API. It won't ever notify, though; updating the UI is a completely disparate operation than serialization of access.
@sjb-sjb Enabling/disabling a control based on something outside the user's control seems like very odd UX to me. The user could easily click on a button, see it become disabled, and yet not have any response to their action. If you could describe your use case in more detail, maybe I can suggest an alternative approach?
from asyncex.
Well, I am copying my sqlite database to and from the appdir so that the user can see their file in their documents directory. I have file open and file new commands that copy an existing or new file respectively. I want to disable file new while file open is in the critical section (which is pretty much all of file open) and vice versa.
Thanks for your comments.
from asyncex.
In that case, I'd just disable the New button while the Open command is in progress.
from asyncex.
Well, yes, I agree. It's just a question of whether "in progress" is coming from the ViewModel or from the Model / service. I just thought the service (file service in this case) should be able to tell all users whether or not an operation is in progress / the service is busy.
Sent from my iPhone
On May 30, 2016, at 10:15 AM, Stephen Cleary [email protected] wrote:
In that case, I'd just disable the New button while the Open command is in progress.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
from asyncex.
If your Model uses INotifyPropertyChanged, then there's no reason not to expose AsyncCommands / NotifyTask from your Model. Personally, I usually don't write my models like that, but if you do, they should work just fine.
from asyncex.
There appear to be more appropriate alternative solutions for this use case rather than exposing IsTaken
.
from asyncex.
Related Issues (20)
- Contradiction? HOT 1
- Support AsyncProducerConsumerQueue wait for empty
- AsyncCollection IsEmpty HOT 3
- [Discussion] Return `ValueTask` instead of `AwaitableDisposable`? HOT 5
- [Question] .WaitAndUnwrapException() vs AsyncContext and potential deadlock HOT 2
- The collection has been marked as complete with regards to additions HOT 1
- Atomic wait semantics lead to continued processing after cancellation HOT 3
- What happened to NotifyTask? HOT 1
- CancellationTokenTaskSource's dispose
- Using LazyAsync with JSONSeralizer? HOT 1
- Producer/Consumer PriorityQueue
- doc/TaskConstants.md links to an article that doesn't exist anymore
- Cross thread Sync context stealing HOT 2
- [Question] Using discard with AsyncLock HOT 1
- [Question] Is ConfigureAwait(false) is needed? HOT 1
- AsyncContext holds exceptions until all tasks complete.
- Feature request: AsyncReaderWriterLock support for UpgradeableReadLock HOT 11
- The ApmAsyncFactory interop hangs if a path in async method returns synchronously. HOT 1
- Setting AsyncAutoResetEvent after used in Task.WhenAny HOT 3
- AsyncLazy with API call is being called twice across 4 components. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncex.