Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blocking thread #87

Closed
TrabacchinLuigi opened this issue Jun 28, 2016 · 8 comments
Closed

blocking thread #87

TrabacchinLuigi opened this issue Jun 28, 2016 · 8 comments

Comments

@TrabacchinLuigi
Copy link
Contributor

I do think that NativeMethods.DokanMain locking the thread while something happens is more annoing than useful and would be better if that function would return after having the file system mounted and then implement some error handling function in the IDokanOperations for errors that could happen in the future while immediate errors could stay there

@Liryna
Copy link
Member

Liryna commented Jun 28, 2016

Hi @TrabacchinLuigi ,

I got a couple of people requesting this features and I always propose to simply call DokanMain in a new thread but I am open to any proposition.

What kind of implementation for errors handling would your propose ?

@TrabacchinLuigi
Copy link
Contributor Author

Not really sure how i don't work with unmanaged code that much...
I would like to just have DokanMain return if everythings goes right and have a HandleDokanError that get's called when docan is going down unexpectedly ... like someone unmounted your drive, or dokany become unavailable for some reason ...
I can share how i actually handle mounting and unmounting the mirror to show why it is a little annoying, also my implementation is disposable and unmount cleanly the disk before shutting down ...

@Liryna
Copy link
Member

Liryna commented Jun 28, 2016

I would prefer to let DokanMain C as it is 😃
I was thinking to make async DokanMain by C# wrapper (Start thread, call event when return..)

I would be interested to see show this is annoying for you, yes.

@TrabacchinLuigi
Copy link
Contributor Author

here we go: How i would write mirror.cs and use it

@TrabacchinLuigi
Copy link
Contributor Author

The annoying part is i have to wait for a semaphore (line 69, that get's green when an exception is thrown during mount or when mounted get's called)... it's not that intuitive ...
Average users would not understand how to use it...
Average user want to do programmatically call like:

Using(var dokan = new DocanNetImplementation()) 
{ 
    dokan.Mount("C:\myfolder", "N:\"); // expect that when this call return N:\ is available
    System.IO.CreateFile("N:\myfile.txt");
}

@marinkobabic
Copy link
Contributor

I think @TrabacchinLuigi is right. For the moment I would keep it like it is until the following issue has been implemented. dokan-dev/dokany#210

@Liryna
Copy link
Member

Liryna commented Jun 28, 2016

@TrabacchinLuigi You made your point 👍
And @marinkobabic is right, this would be solved by issue dokan-dev/dokany#210
We would have DokanMain C return at the Mount.

It also mean that the DokanMain async will probably more be in 1.1.0 than in the next release.

@TrabacchinLuigi
Copy link
Contributor Author

Great! keep up the good work!
i'll keep this open as a remainder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants