如果正在运行2个thred,并且在访问资源时1个线程崩溃之间。应用程序如何响应? [英] If there are 2 threds are running, , and in between 1 thread crashes while accesing resource. How application responds?

查看:51
本文介绍了如果正在运行2个thred,并且在访问资源时1个线程崩溃之间。应用程序如何响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果正在运行2个thred,并且在访问资源时1个线程崩溃之间。但其他线程将等待线程释放ryt?应用程序如何响应?



我尝试过:



我没有尝试任何东西。我不知道应用程序如何响应

If there are 2 threds are running,, and in between 1 thread crashes while accesing resource. But other thread will be waiting for the thread to release ryt ?How application responds?

What I have tried:

I did not tried anything. I dont know how application responds

推荐答案

1。您应该顺利处理对资源的访问,因此线程不会崩溃。总有一些API可以实现。



2.否则你应该检测崩溃并通过一些崩溃处理来处理崩溃,比如try-catch块并决定做什么。



3.可能是所有线程都可以访问的全局数据。而不是重新启动线程。



更详细的答案都是非特定的。
1. You should handle the access to the resource smoothly, so the thread doesnt crash. There is always some API which makes it possible.

2. Else you should detect the crash and handle the crash with some crash handling like try-catch block and decide what to do.

3. Maybe a global data which all the threads can access. And than restart the thread.

It is all to unspecific for a more detailed answer.


这篇关于如果正在运行2个thred,并且在访问资源时1个线程崩溃之间。应用程序如何响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆