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

Support Multiple Threads for Linux and Darwin only. #19

Closed
8 of 9 tasks
winlinvip opened this issue Feb 23, 2021 · 4 comments
Closed
8 of 9 tasks

Support Multiple Threads for Linux and Darwin only. #19

winlinvip opened this issue Feb 23, 2021 · 4 comments

Comments

@winlinvip
Copy link
Member

winlinvip commented Feb 23, 2021

For WebRTC or UDP transport system, multiple threads or CPUs is essential important, please read ossrs/srs#2188

The first step, is to simplify the state-threads. We should remove the dead code for UDP server:

  • Remove multiple OS support, only for Linux(CentOS,Ubuntu,etc) and Darwin(macOS).
  • Remove the examples and extensions.
  • Remove the poll support, only Linux epoll and Darwin kqueue.
  • Remove the support for multiple processes, for single process only.
  • Stack always grows from top to down.
  • Remove the deprecated serialize accept.

Then, we should use gcc __thread for multiple threads:

@winlinvip
Copy link
Member Author

winlinvip commented Mar 2, 2021

UTest and coverage for ST is introduced by SRS#1b2822a5a4, of course, it'll be merged to this repository if done.

image

@winlinvip winlinvip changed the title Support Multiple Threads for Linux and Darwin. Support Multiple Threads for Linux and Darwin only. Mar 2, 2021
winlinvip added a commit that referenced this issue Mar 21, 2021
1. Remove examples and extensions.
2. Remove OS support, except LINUX and DARWIN.
3. Rename md.S to md_linux.S, remove __ia64__ support.
4. Remove events support, except kqueue and epoll.
5. Refine utest, add auto/fast.sh support.
@winlinvip
Copy link
Member Author

winlinvip commented Mar 21, 2021

对ST做了大幅度简化:eda23b2

For #19: Simplify ST, only support LINUX and DARWIN

1. Remove examples and extensions.
2. Remove OS support, except LINUX and DARWIN.
3. Rename md.S to md_linux.S, remove __ia64__ support.
4. Remove events support, except kqueue and epoll.
5. Refine utest, add auto/fast.sh support.

简化前,一共是9123行,核心代码5834行:

homeMacOS:state-threads winlin$ wc -l *.h *.c *.S 
     480 common.h
     645 md.h
     176 public.h
    1446 event.c
     922 io.c
     121 key.c
     783 sched.c
     173 stk.c
     368 sync.c
     644 md.S
      76 md_darwin.S
    5834 total

简化后,核心代码4448行:

homeMacOS:state-threads winlin$ wc -l *.h *.c *.S 
     473 common.h
     232 md.h
     174 public.h
     913 event.c
     815 io.c
     121 key.c
     751 sched.c
     173 stk.c
     368 sync.c
      76 md_darwin.S
     352 md_linux.S
    4448 total

一共简化了1386行代码,23%左右代码。简化后,UTest和覆盖的难度降低了,之前存在大量无法覆盖的代码。

简化后,只支持LINUX和DARWIN平台,事件框架只支持kqueue和epoll。

@winlinvip
Copy link
Member Author

winlinvip commented Jun 23, 2022

@winlinvip
Copy link
Member Author

多线程的单元测试,单独提了一个issue #31

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

No branches or pull requests

1 participant