add fiber demo for IOS

This commit is contained in:
shuxin   zheng 2020-09-26 23:14:11 +08:00
parent 72ae883ba0
commit 17adcd823e
27 changed files with 1330 additions and 11 deletions

View File

@ -1,6 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<Group
location = "container:"
name = "samples">
<Group
location = "container:"
name = "fiber">
<FileRef
location = "group:lib_fiber/samples/xcode/fiber_server/fiber_server.xcodeproj">
</FileRef>
</Group>
</Group>
<FileRef
location = "group:lib_fiber/fiber_cpp.xcodeproj">
</FileRef>

View File

@ -23,12 +23,14 @@ add_definitions(
"-DACL_WRITEABLE_CHECK"
"-Wno-long-long"
"-Wuninitialized"
"-DUSE_JMP"
# "-DUSE_JMP"
"-DUSE_FAST_RING"
"-D_POSIX_PTHREAD_SEMANTICS"
"-DACL_PREPARE_COMPILE"
# "-Wno-invalid-source-encoding"
"-Wstrict-prototypes"
# "-DUSE_JMP_DEF"
"-DUSE_BOOST_JMP"
)
if (CMAKE_BUILD_TYPE STREQUAL "")
@ -73,8 +75,12 @@ set(sources
foreach(iter ${sources})
aux_source_directory(${iter} lib_src)
message(STATUS ">>add dir "${iter})
endforeach()
list(APPEND lib_src ${src}/fiber/boost/make_gas.S
${src}/fiber/boost/jump_gas.S)
if(NOT CMAKE_SYSTEM_NAME MATCHES "ANDROID")
set(lib_output_path ${PROJECT_BINARY_DIR}/lib)

View File

@ -11,18 +11,19 @@ CFLAGS = -c -g -W \
-std=gnu99 \
-fPIC \
-Wall \
-Waggregate-return \
-Wpointer-arith \
-Wshadow \
-D_REENTRANT \
-D_POSIX_PTHREAD_SEMANTICS \
-D_USE_FAST_MACRO \
-Wno-long-long \
-DUSE_JMP \
-Wmissing-prototypes \
-Wcast-qual \
-DUSE_FAST_RING \
-DUSE_JMP_DEF \
#-DUSE_BOOST_JMP \
#-DUSE_FAST_TIME \
#-Waggregate-return \
#-DDEBUG_MEM \
#-DUSE_VALGRIND \
#-I/usr/local/include
@ -147,7 +148,9 @@ SRC = $(wildcard $(SRC_PATH_SRC)/*.c) \
$(wildcard $(SRC_PATH_SRC)/event/*.c) \
$(wildcard $(SRC_PATH_SRC)/hook/*.c)
OBJ = $(patsubst %.c, $(OBJ_PATH_DST)/%.o, $(notdir $(SRC)))
#ASM_OBJ=$(OBJ_PATH_DST)/setjmp.o $(OBJ_PATH_DST)/make_gas.o $(OBJ_PATH_DST)/jump_gas.o
ASM_OBJ=$(OBJ_PATH_DST)/make_gas.o $(OBJ_PATH_DST)/jump_gas.o
OBJ = $(patsubst %.c, $(OBJ_PATH_DST)/%.o, $(notdir $(SRC))) $(ASM_OBJ)
###########################################################
@ -211,6 +214,12 @@ $(OBJ_PATH_DST)/%.o: $(SRC_PATH_SRC)/dns/%.c
$(COMPILE) $< -o $@
$(OBJ_PATH_DST)/%.o: $(SRC_PATH_SRC)/fiber/%.c
$(COMPILE) $< -o $@
#$(OBJ_PATH_DST)/setjmp.o: $(SRC_PATH_SRC)/fiber/exp/setjmp.S
# $(COMPILE) $< -o $@
$(OBJ_PATH_DST)/make_gas.o: $(SRC_PATH_SRC)/fiber/boost/make_gas.S
$(COMPILE) $< -o $@
$(OBJ_PATH_DST)/jump_gas.o: $(SRC_PATH_SRC)/fiber/boost/jump_gas.S
$(COMPILE) $< -o $@
$(OBJ_PATH_DST)/%.o: $(SRC_PATH_SRC)/event/%.c
$(COMPILE) $< -o $@
$(OBJ_PATH_DST)/%.o: $(SRC_PATH_SRC)/hook/%.c

View File

@ -96,6 +96,11 @@
07BED4CC21BA270A0060BBE4 /* fiber_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = 07BED4CB21BA270A0060BBE4 /* fiber_cond.c */; };
07BED4CE21BA271F0060BBE4 /* fbase_event.c in Sources */ = {isa = PBXBuildFile; fileRef = 07BED4CD21BA271F0060BBE4 /* fbase_event.c */; };
07BED4D021BA27530060BBE4 /* fiber_cond.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BED4CF21BA27530060BBE4 /* fiber_cond.h */; };
70753A3D251F8F67005B6E56 /* unix_jmp.h in Headers */ = {isa = PBXBuildFile; fileRef = 70753A3A251F8F67005B6E56 /* unix_jmp.h */; };
70753A3E251F8F67005B6E56 /* boost_jmp.h in Headers */ = {isa = PBXBuildFile; fileRef = 70753A3B251F8F67005B6E56 /* boost_jmp.h */; };
70753A3F251F8F67005B6E56 /* exp_jmp.h in Headers */ = {isa = PBXBuildFile; fileRef = 70753A3C251F8F67005B6E56 /* exp_jmp.h */; };
70753B03251F91E9005B6E56 /* jump_gas.S in Sources */ = {isa = PBXBuildFile; fileRef = 70753B01251F91E9005B6E56 /* jump_gas.S */; };
70753B04251F91E9005B6E56 /* make_gas.S in Sources */ = {isa = PBXBuildFile; fileRef = 70753B02251F91E9005B6E56 /* make_gas.S */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -189,6 +194,11 @@
07BED4CB21BA270A0060BBE4 /* fiber_cond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fiber_cond.c; path = c/src/fiber_cond.c; sourceTree = "<group>"; };
07BED4CD21BA271F0060BBE4 /* fbase_event.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fbase_event.c; path = c/src/fbase_event.c; sourceTree = "<group>"; };
07BED4CF21BA27530060BBE4 /* fiber_cond.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fiber_cond.h; path = c/include/fiber/fiber_cond.h; sourceTree = "<group>"; };
70753A3A251F8F67005B6E56 /* unix_jmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unix_jmp.h; sourceTree = "<group>"; };
70753A3B251F8F67005B6E56 /* boost_jmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boost_jmp.h; sourceTree = "<group>"; };
70753A3C251F8F67005B6E56 /* exp_jmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = exp_jmp.h; sourceTree = "<group>"; };
70753B01251F91E9005B6E56 /* jump_gas.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = jump_gas.S; path = boost/jump_gas.S; sourceTree = "<group>"; };
70753B02251F91E9005B6E56 /* make_gas.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = make_gas.S; path = boost/make_gas.S; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -334,6 +344,10 @@
070F35772090225C00672EDC /* fiber */ = {
isa = PBXGroup;
children = (
70753B00251F91C2005B6E56 /* boost */,
70753A3B251F8F67005B6E56 /* boost_jmp.h */,
70753A3C251F8F67005B6E56 /* exp_jmp.h */,
70753A3A251F8F67005B6E56 /* unix_jmp.h */,
070F35782090225C00672EDC /* fiber_unix.c */,
070F35792090225C00672EDC /* fiber_win.c */,
);
@ -375,6 +389,15 @@
name = fiber;
sourceTree = "<group>";
};
70753B00251F91C2005B6E56 /* boost */ = {
isa = PBXGroup;
children = (
70753B01251F91E9005B6E56 /* jump_gas.S */,
70753B02251F91E9005B6E56 /* make_gas.S */,
);
name = boost;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -394,6 +417,7 @@
070F35B12090225C00672EDC /* define.h in Headers */,
070F35A72090225C00672EDC /* pthread_patch.h in Headers */,
070F35992090225C00672EDC /* gettimeofday.h in Headers */,
70753A3E251F8F67005B6E56 /* boost_jmp.h in Headers */,
070F35A32090225C00672EDC /* msg.h in Headers */,
07BED4D021BA27530060BBE4 /* fiber_cond.h in Headers */,
070F35A92090225C00672EDC /* ring.h in Headers */,
@ -411,10 +435,12 @@
070F35BD2090225C00672EDC /* event_kqueue.h in Headers */,
070F35BB2090225C00672EDC /* event_iocp.h in Headers */,
070F35C12090225C00672EDC /* event_select.h in Headers */,
70753A3D251F8F67005B6E56 /* unix_jmp.h in Headers */,
070F35B52090225C00672EDC /* sane_inet.h in Headers */,
070F35322090220400672EDC /* fiber_base.h in Headers */,
070F35AB2090225C00672EDC /* sane_socket.h in Headers */,
070F35BF2090225C00672EDC /* event_poll.h in Headers */,
70753A3F251F8F67005B6E56 /* exp_jmp.h in Headers */,
070F35332090220400672EDC /* fiber_channel.h in Headers */,
070F353A2090220400672EDC /* libfiber.h in Headers */,
070F35B02090225C00672EDC /* common.h in Headers */,
@ -531,6 +557,8 @@
070F35952090225C00672EDC /* doze.c in Sources */,
070F35CE2090225C00672EDC /* file_event.c in Sources */,
070F35CC2090225C00672EDC /* fiber.c in Sources */,
70753B03251F91E9005B6E56 /* jump_gas.S in Sources */,
70753B04251F91E9005B6E56 /* make_gas.S in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -574,7 +602,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
USE_BOOST_JMP,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@ -624,6 +652,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = USE_BOOST_JMP;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@ -641,11 +670,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
USE_JMP,
);
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited) ";
HEADER_SEARCH_PATHS = (
../lib_fiber/c/include,
../lib_fiber/c/src,
@ -673,7 +698,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = USE_JMP;
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited) ";
HEADER_SEARCH_PATHS = (
../lib_fiber/c/include,
../lib_fiber/c/src,

View File

@ -0,0 +1,525 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
707539FB251E4AB0005B6E56 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 707539FA251E4AB0005B6E56 /* AppDelegate.m */; };
707539FE251E4AB0005B6E56 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 707539FD251E4AB0005B6E56 /* SceneDelegate.m */; };
70753A01251E4AB0005B6E56 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 70753A00251E4AB0005B6E56 /* ViewController.m */; };
70753A04251E4AB0005B6E56 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 70753A02251E4AB0005B6E56 /* Main.storyboard */; };
70753A06251E4AB4005B6E56 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 70753A05251E4AB4005B6E56 /* Assets.xcassets */; };
70753A09251E4AB4005B6E56 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 70753A07251E4AB4005B6E56 /* LaunchScreen.storyboard */; };
70753A0C251E4AB4005B6E56 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 70753A0B251E4AB4005B6E56 /* main.m */; };
70753A16251E4AB4005B6E56 /* fiber_serverUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 70753A15251E4AB4005B6E56 /* fiber_serverUITests.m */; };
70753A28251ECE7E005B6E56 /* FiberServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70753A26251ECE7E005B6E56 /* FiberServer.cpp */; };
70753A2B251ED051005B6E56 /* FiberClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70753A29251ED051005B6E56 /* FiberClient.cpp */; };
70753A36251ED92C005B6E56 /* FiberThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70753A34251ED92C005B6E56 /* FiberThread.cpp */; };
70753A38251EDC5B005B6E56 /* FiberTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 70753A37251EDC5B005B6E56 /* FiberTest.mm */; };
70753AF7251F9116005B6E56 /* libfiber.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70753AF6251F9116005B6E56 /* libfiber.a */; };
70753AF9251F9116005B6E56 /* libfiber_cpp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70753AF8251F9116005B6E56 /* libfiber_cpp.a */; };
70753AFB251F914D005B6E56 /* libacl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70753AFA251F914D005B6E56 /* libacl.a */; };
70753AFD251F914D005B6E56 /* libacl_cpp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70753AFC251F914D005B6E56 /* libacl_cpp.a */; };
70753AFF251F914D005B6E56 /* libprotocol.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 70753AFE251F914D005B6E56 /* libprotocol.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
70753A12251E4AB4005B6E56 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 707539EE251E4AB0005B6E56 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 707539F5251E4AB0005B6E56;
remoteInfo = fiber_server;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
707539F6251E4AB0005B6E56 /* fiber_server.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = fiber_server.app; sourceTree = BUILT_PRODUCTS_DIR; };
707539F9251E4AB0005B6E56 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
707539FA251E4AB0005B6E56 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
707539FC251E4AB0005B6E56 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
707539FD251E4AB0005B6E56 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
707539FF251E4AB0005B6E56 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
70753A00251E4AB0005B6E56 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
70753A03251E4AB0005B6E56 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
70753A05251E4AB4005B6E56 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
70753A08251E4AB4005B6E56 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
70753A0A251E4AB4005B6E56 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
70753A0B251E4AB4005B6E56 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
70753A11251E4AB4005B6E56 /* fiber_serverUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = fiber_serverUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
70753A15251E4AB4005B6E56 /* fiber_serverUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = fiber_serverUITests.m; sourceTree = "<group>"; };
70753A17251E4AB4005B6E56 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
70753A26251ECE7E005B6E56 /* FiberServer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FiberServer.cpp; sourceTree = "<group>"; };
70753A27251ECE7E005B6E56 /* FiberServer.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = FiberServer.hpp; sourceTree = "<group>"; };
70753A29251ED051005B6E56 /* FiberClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FiberClient.cpp; sourceTree = "<group>"; };
70753A2A251ED051005B6E56 /* FiberClient.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = FiberClient.hpp; sourceTree = "<group>"; };
70753A2D251ED514005B6E56 /* libfiber.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libfiber.a; sourceTree = BUILT_PRODUCTS_DIR; };
70753A2F251ED514005B6E56 /* libfiber_cpp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libfiber_cpp.a; sourceTree = BUILT_PRODUCTS_DIR; };
70753A34251ED92C005B6E56 /* FiberThread.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FiberThread.cpp; sourceTree = "<group>"; };
70753A35251ED92C005B6E56 /* FiberThread.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = FiberThread.hpp; sourceTree = "<group>"; };
70753A37251EDC5B005B6E56 /* FiberTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FiberTest.mm; sourceTree = "<group>"; };
70753A39251EDC87005B6E56 /* FiberTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FiberTest.h; sourceTree = "<group>"; };
70753AF6251F9116005B6E56 /* libfiber.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libfiber.a; sourceTree = BUILT_PRODUCTS_DIR; };
70753AF8251F9116005B6E56 /* libfiber_cpp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libfiber_cpp.a; sourceTree = BUILT_PRODUCTS_DIR; };
70753AFA251F914D005B6E56 /* libacl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libacl.a; sourceTree = BUILT_PRODUCTS_DIR; };
70753AFC251F914D005B6E56 /* libacl_cpp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libacl_cpp.a; sourceTree = BUILT_PRODUCTS_DIR; };
70753AFE251F914D005B6E56 /* libprotocol.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libprotocol.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
707539F3251E4AB0005B6E56 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
70753AFB251F914D005B6E56 /* libacl.a in Frameworks */,
70753AFD251F914D005B6E56 /* libacl_cpp.a in Frameworks */,
70753AFF251F914D005B6E56 /* libprotocol.a in Frameworks */,
70753AF7251F9116005B6E56 /* libfiber.a in Frameworks */,
70753AF9251F9116005B6E56 /* libfiber_cpp.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
70753A0E251E4AB4005B6E56 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
707539ED251E4AB0005B6E56 = {
isa = PBXGroup;
children = (
707539F8251E4AB0005B6E56 /* fiber_server */,
70753A14251E4AB4005B6E56 /* fiber_serverUITests */,
707539F7251E4AB0005B6E56 /* Products */,
70753A2C251ED514005B6E56 /* Frameworks */,
);
sourceTree = "<group>";
};
707539F7251E4AB0005B6E56 /* Products */ = {
isa = PBXGroup;
children = (
707539F6251E4AB0005B6E56 /* fiber_server.app */,
70753A11251E4AB4005B6E56 /* fiber_serverUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
707539F8251E4AB0005B6E56 /* fiber_server */ = {
isa = PBXGroup;
children = (
707539F9251E4AB0005B6E56 /* AppDelegate.h */,
707539FA251E4AB0005B6E56 /* AppDelegate.m */,
707539FC251E4AB0005B6E56 /* SceneDelegate.h */,
707539FD251E4AB0005B6E56 /* SceneDelegate.m */,
707539FF251E4AB0005B6E56 /* ViewController.h */,
70753A00251E4AB0005B6E56 /* ViewController.m */,
70753A02251E4AB0005B6E56 /* Main.storyboard */,
70753A05251E4AB4005B6E56 /* Assets.xcassets */,
70753A07251E4AB4005B6E56 /* LaunchScreen.storyboard */,
70753A0A251E4AB4005B6E56 /* Info.plist */,
70753A0B251E4AB4005B6E56 /* main.m */,
70753A26251ECE7E005B6E56 /* FiberServer.cpp */,
70753A27251ECE7E005B6E56 /* FiberServer.hpp */,
70753A29251ED051005B6E56 /* FiberClient.cpp */,
70753A2A251ED051005B6E56 /* FiberClient.hpp */,
70753A34251ED92C005B6E56 /* FiberThread.cpp */,
70753A35251ED92C005B6E56 /* FiberThread.hpp */,
70753A37251EDC5B005B6E56 /* FiberTest.mm */,
70753A39251EDC87005B6E56 /* FiberTest.h */,
);
path = fiber_server;
sourceTree = "<group>";
};
70753A14251E4AB4005B6E56 /* fiber_serverUITests */ = {
isa = PBXGroup;
children = (
70753A15251E4AB4005B6E56 /* fiber_serverUITests.m */,
70753A17251E4AB4005B6E56 /* Info.plist */,
);
path = fiber_serverUITests;
sourceTree = "<group>";
};
70753A2C251ED514005B6E56 /* Frameworks */ = {
isa = PBXGroup;
children = (
70753AFA251F914D005B6E56 /* libacl.a */,
70753AFC251F914D005B6E56 /* libacl_cpp.a */,
70753AFE251F914D005B6E56 /* libprotocol.a */,
70753AF6251F9116005B6E56 /* libfiber.a */,
70753AF8251F9116005B6E56 /* libfiber_cpp.a */,
70753A2D251ED514005B6E56 /* libfiber.a */,
70753A2F251ED514005B6E56 /* libfiber_cpp.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
707539F5251E4AB0005B6E56 /* fiber_server */ = {
isa = PBXNativeTarget;
buildConfigurationList = 70753A1A251E4AB4005B6E56 /* Build configuration list for PBXNativeTarget "fiber_server" */;
buildPhases = (
707539F2251E4AB0005B6E56 /* Sources */,
707539F3251E4AB0005B6E56 /* Frameworks */,
707539F4251E4AB0005B6E56 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = fiber_server;
productName = fiber_server;
productReference = 707539F6251E4AB0005B6E56 /* fiber_server.app */;
productType = "com.apple.product-type.application";
};
70753A10251E4AB4005B6E56 /* fiber_serverUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 70753A1D251E4AB4005B6E56 /* Build configuration list for PBXNativeTarget "fiber_serverUITests" */;
buildPhases = (
70753A0D251E4AB4005B6E56 /* Sources */,
70753A0E251E4AB4005B6E56 /* Frameworks */,
70753A0F251E4AB4005B6E56 /* Resources */,
);
buildRules = (
);
dependencies = (
70753A13251E4AB4005B6E56 /* PBXTargetDependency */,
);
name = fiber_serverUITests;
productName = fiber_serverUITests;
productReference = 70753A11251E4AB4005B6E56 /* fiber_serverUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
707539EE251E4AB0005B6E56 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1170;
ORGANIZATIONNAME = acl;
TargetAttributes = {
707539F5251E4AB0005B6E56 = {
CreatedOnToolsVersion = 11.7;
};
70753A10251E4AB4005B6E56 = {
CreatedOnToolsVersion = 11.7;
TestTargetID = 707539F5251E4AB0005B6E56;
};
};
};
buildConfigurationList = 707539F1251E4AB0005B6E56 /* Build configuration list for PBXProject "fiber_server" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 707539ED251E4AB0005B6E56;
productRefGroup = 707539F7251E4AB0005B6E56 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
707539F5251E4AB0005B6E56 /* fiber_server */,
70753A10251E4AB4005B6E56 /* fiber_serverUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
707539F4251E4AB0005B6E56 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
70753A09251E4AB4005B6E56 /* LaunchScreen.storyboard in Resources */,
70753A06251E4AB4005B6E56 /* Assets.xcassets in Resources */,
70753A04251E4AB0005B6E56 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
70753A0F251E4AB4005B6E56 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
707539F2251E4AB0005B6E56 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
70753A01251E4AB0005B6E56 /* ViewController.m in Sources */,
707539FB251E4AB0005B6E56 /* AppDelegate.m in Sources */,
70753A36251ED92C005B6E56 /* FiberThread.cpp in Sources */,
70753A28251ECE7E005B6E56 /* FiberServer.cpp in Sources */,
70753A2B251ED051005B6E56 /* FiberClient.cpp in Sources */,
70753A0C251E4AB4005B6E56 /* main.m in Sources */,
70753A38251EDC5B005B6E56 /* FiberTest.mm in Sources */,
707539FE251E4AB0005B6E56 /* SceneDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
70753A0D251E4AB4005B6E56 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
70753A16251E4AB4005B6E56 /* fiber_serverUITests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
70753A13251E4AB4005B6E56 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 707539F5251E4AB0005B6E56 /* fiber_server */;
targetProxy = 70753A12251E4AB4005B6E56 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
70753A02251E4AB0005B6E56 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
70753A03251E4AB0005B6E56 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
70753A07251E4AB4005B6E56 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
70753A08251E4AB4005B6E56 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
70753A18251E4AB4005B6E56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = ../../../cpp/include;
IPHONEOS_DEPLOYMENT_TARGET = 13.7;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
70753A19251E4AB4005B6E56 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = ../../../cpp/include;
IPHONEOS_DEPLOYMENT_TARGET = 13.7;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
70753A1B251E4AB4005B6E56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = fiber_server/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "acl.fiber-server";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
70753A1C251E4AB4005B6E56 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
HEADER_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = fiber_server/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "acl.fiber-server";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
70753A1E251E4AB4005B6E56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = fiber_serverUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "acl.fiber-serverUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = fiber_server;
};
name = Debug;
};
70753A1F251E4AB4005B6E56 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = fiber_serverUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "acl.fiber-serverUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = fiber_server;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
707539F1251E4AB0005B6E56 /* Build configuration list for PBXProject "fiber_server" */ = {
isa = XCConfigurationList;
buildConfigurations = (
70753A18251E4AB4005B6E56 /* Debug */,
70753A19251E4AB4005B6E56 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
70753A1A251E4AB4005B6E56 /* Build configuration list for PBXNativeTarget "fiber_server" */ = {
isa = XCConfigurationList;
buildConfigurations = (
70753A1B251E4AB4005B6E56 /* Debug */,
70753A1C251E4AB4005B6E56 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
70753A1D251E4AB4005B6E56 /* Build configuration list for PBXNativeTarget "fiber_serverUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
70753A1E251E4AB4005B6E56 /* Debug */,
70753A1F251E4AB4005B6E56 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 707539EE251E4AB0005B6E56 /* Project object */;
}

View File

@ -0,0 +1,15 @@
//
// AppDelegate.h
// fiber_server
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@end

View File

@ -0,0 +1,41 @@
//
// AppDelegate.m
// fiber_server
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
#pragma mark - UISceneSession lifecycle
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
@end

View File

@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Listen" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Xz-H5-qZq">
<rect key="frame" x="29" y="155" width="46" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="lfX-lX-1FI">
<rect key="frame" x="95" y="148" width="195" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Qor-Pr-t5Q">
<rect key="frame" x="314" y="148" width="34" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Start"/>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="52.173913043478265" y="375"/>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,29 @@
//
// FiberClient.cpp
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#include <stdio.h>
#include <unistd.h>
#include "fiber/libfiber.hpp"
#include "FiberClient.hpp"
void FiberClient::run(void) {
printf("FiberClient run, fd=%d\r\n", fd_);
char buf[8192];
while (true) {
ssize_t ret = read(fd_, buf, sizeof(buf));
if (ret <= 0) {
break;
}
if (write(fd_, buf, ret) <= 0) {
break;
}
}
printf("Close client fd=%d\r\n", fd_);
close(fd_);
delete this;
}

View File

@ -0,0 +1,26 @@
//
// FiberClient.hpp
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#ifndef FiberClient_hpp
#define FiberClient_hpp
class FiberClient : public acl::fiber {
public:
FiberClient(int fd) : fd_(fd) {}
protected:
// @override
void run(void);
~FiberClient(void) {}
private:
int fd_;
};
#endif /* FiberClient_hpp */

View File

@ -0,0 +1,78 @@
//
// FiberServer.cpp
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#include <stdio.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "fiber/libfiber.hpp"
#include "FiberClient.hpp"
#include "FiberServer.hpp"
FiberServer::FiberServer(const char* ip, int port)
: ip_(ip), port_(port), lfd_(-1) {}
int FiberServer::BindAndrListen(const char *ip, int port) {
int fd;
int on;
struct sockaddr_in sa;
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(port);
sa.sin_addr.s_addr = inet_addr(ip);
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd == -1) {
printf("create socket error, %s\r\n", acl::fiber::last_serror());
return -1;
}
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) {
printf("setsockopt error %s\r\n", acl::fiber::last_serror());
close(fd);
return -1;
}
if (bind(fd, (struct sockaddr *) &sa, sizeof(struct sockaddr)) < 0) {
printf("bind error %s\r\n", acl::fiber::last_serror());
close(fd);
return -1;
}
if (listen(fd, 1024) < 0) {
printf("listen error %s\r\n", acl::fiber::last_serror());
close(fd);
return -1;
}
return fd;
}
void FiberServer::run(void) {
lfd_ = BindAndrListen(ip_.c_str(), port_);
if (lfd_ == -1) {
return;
}
printf("listen %s:%d ok\r\n", ip_.c_str(), port_);
while (true) {
struct sockaddr_in sa;
size_t len = sizeof(sa);
int fd = accept(lfd_, (struct sockaddr *)& sa, (socklen_t *)& len);
if (fd == -1) {
printf("accept error\r\n");
break;
}
printf("Accept on fd=%d\r\n", fd);
FiberClient* fb = new FiberClient(fd);
fb->start();
}
close(lfd_);
delete this;
}

View File

@ -0,0 +1,32 @@
//
// FiberServer.hpp
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#ifndef FiberServer_hpp
#define FiberServer_hpp
#include <string>
class FiberServer : public acl::fiber {
public:
FiberServer(const char* ip, int port);
protected:
// @override
void run(void);
~FiberServer(void) {}
private:
std::string ip_;
int port_;
int lfd_;
int BindAndrListen(const char *ip, int port);
};
#endif /* FiberServer_hpp */

View File

@ -0,0 +1,18 @@
//
// FiberTest.h
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#ifndef FiberTest_h
#define FiberTest_h
@interface FiberTest : NSObject
-(void) Start;
@end
#endif /* FiberTest_h */

View File

@ -0,0 +1,20 @@
//
// FiberTest.m
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#import <Foundation/Foundation.h>
#include "FiberThread.hpp"
#include "FiberTest.h"
@implementation FiberTest
-(void) Start
{
StartThread();
}
@end

View File

@ -0,0 +1,26 @@
//
// FiberTest.cpp
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#include <thread>
#include "fiber/libfiber.hpp"
#include "FiberServer.hpp"
#include "FiberThread.hpp"
static void ThreadRun(void) {
const char* ip = "127.0.0.1";
int port = 8192;
FiberServer* fb = new FiberServer(ip, port);
fb->start();
acl::fiber::schedule();
}
void StartThread(void) {
std::thread* thread = new std::thread(ThreadRun);
thread->detach();
}

View File

@ -0,0 +1,16 @@
//
// FiberTest.hpp
// fiber_server
//
// Created by shuxin   zheng on 2020/9/26.
// Copyright © 2020 acl. All rights reserved.
//
#ifndef FiberTest_hpp
#define FiberTest_hpp
#include <stdio.h>
void StartThread(void);
#endif /* FiberTest_hpp */

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,16 @@
//
// SceneDelegate.h
// fiber_server
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
@property (strong, nonatomic) UIWindow * window;
@end

View File

@ -0,0 +1,58 @@
//
// SceneDelegate.m
// fiber_server
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import "SceneDelegate.h"
@interface SceneDelegate ()
@end
@implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
}
- (void)sceneDidDisconnect:(UIScene *)scene {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
- (void)sceneDidBecomeActive:(UIScene *)scene {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
- (void)sceneWillResignActive:(UIScene *)scene {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
- (void)sceneWillEnterForeground:(UIScene *)scene {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
- (void)sceneDidEnterBackground:(UIScene *)scene {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
@end

View File

@ -0,0 +1,15 @@
//
// ViewController.h
// fiber_server
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end

View File

@ -0,0 +1,26 @@
//
// ViewController.m
// fiber_server
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import "ViewController.h"
#import "FiberTest.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
FiberTest *test = [[FiberTest alloc] init];
[test Start];
}
@end

View File

@ -0,0 +1,19 @@
//
// main.m
// fiber_server
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
NSString * appDelegateClassName;
@autoreleasepool {
// Setup code that might create autoreleased objects goes here.
appDelegateClassName = NSStringFromClass([AppDelegate class]);
}
return UIApplicationMain(argc, argv, nil, appDelegateClassName);
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -0,0 +1,48 @@
//
// fiber_serverUITests.m
// fiber_serverUITests
//
// Created by shuxin   zheng on 2020/9/25.
// Copyright © 2020 acl. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface fiber_serverUITests : XCTestCase
@end
@implementation fiber_serverUITests
- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
self.continueAfterFailure = NO;
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
- (void)testExample {
// UI tests must launch the application that they test.
XCUIApplication *app = [[XCUIApplication alloc] init];
[app launch];
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testLaunchPerformance {
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
// This measures how long it takes to launch your application.
[self measureWithMetrics:@[XCTOSSignpostMetric.applicationLaunchMetric] block:^{
[[[XCUIApplication alloc] init] launch];
}];
}
}
@end