Git Product home page Git Product logo

Comments (5)

AndroidInternal avatar AndroidInternal commented on August 15, 2024

搜索实践一下fork的用法。不太准确的描述,你可以认为fork会返回2次,一次在主进程一次在子进程,等于0时代表当前在子进程。

from koom.

aWangami avatar aWangami commented on August 15, 2024

image

多加了一条日志把 Pid 打印出来,只有 Pid = 11615,没有 Pid = 0。是不是要特殊场景才会触发?

from koom.

AndroidInternal avatar AndroidInternal commented on August 15, 2024

不需要特殊场景。有两点确认下:

1.fork进程是单线程的,子进程只有当前线程一个线程存活,logcat应该会失效、logcat日志是无法在控制台显示的

2.fork返回的两次会在两个不同的进程,所以即使能够查看logcat日志,也需要展示所有进程的日志

from koom.

aWangami avatar aWangami commented on August 15, 2024

是的,确实是 🤦‍♂️ 我在 Logcat 里面被过滤掉了

image

from koom.

aWangami avatar aWangami commented on August 15, 2024

是我对 fork 这一块的理解还不够,3Q

from koom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.