15,905,508 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by eric881027 (Top 15 by date)
eric881027
27-Feb-15 22:10pm
View
Thanks for your informative answer!
But in the articles the cancel is called inside of the task, of course, the exception will be throw by the task thread, and if you call the cancel() by click button, the exception will be throw in _cancel.Cancel()(main thread).
As you said, every thread has an exception stack(if I understand correctly),and exception will be "created" in the thread who raise it right, it seems like there is no way one thread can throw an exception in the other thread except abort the other thread directly.
Maybe I can implement it like this:
Task.Run(() =>
{
try
{
var currentThread = Thread.CurrentThread;
_cancel.Token.Register(currentThread.Abort);
DoWork();
}
catch (Exception)
{
throw;
}
})
eric881027
27-Feb-15 10:00am
View
I think this solution is not suitable for my problem, this solution can handle the case that task will throw the exception by himself. what I want is there is a long running operation in the task, and user wants to cancel this task by clicking the button like a trigger, it is better to throw an exception from the task after cancel token is notified that it is canceled, cause I want to do the clean up staff outside.
eric881027
10-Aug-11 5:02am
View
Windows service does work, I found I need run the Windows service first,and then add the Service References in the client project.
eric881027
25-Jul-11 2:33am
View
No,I do it all on the code,as the SQL CE does not support the stored procedures
eric881027
25-Jul-11 2:04am
View
Yeah,I am working by this way.
eric881027
25-Jul-11 1:51am
View
But I have to use the SQL CE,it does not support trigger.
eric881027
25-Jul-11 1:32am
View
Yeah,this is what I am thinking about.Do you have any experience about that,what need be paid attention to?
eric881027
25-Jul-11 1:12am
View
if can I record all the actions in a table or a log?
eric881027
15-Jul-11 5:13am
View
Just using the Internet Ip will be ok?
eric881027
15-Jul-11 3:37am
View
I mean for example I am in USA,and the computer is in China,I know the computer's
intranet ip and internet ip, we are not in the same intranet.Can I send the message like this, and how is the ip will be?
Thanks
eric881027
14-Jul-11 2:43am
View
I'm sorry, I didn't make it clear, I mean messages for the underlying transport.
eric881027
12-Jul-11 1:16am
View
Ok,thanks,do you think the Service Broker can handle this effect?
eric881027
12-Jul-11 1:16am
View
Ok,thanks,do you think the Service Broker can handle this effect?
eric881027
11-Jul-11 22:16pm
View
Thanks,locking the database is also a good solution,my point is how the database tell users who is editing the data,or the app has to read the database all the time to get this information.
eric881027
11-Jul-11 22:03pm
View
Yeah,I thought about that,by this way the app have to read the data all the time.I want the database takes the initiative to send a message to the app.
Show More