forked from ossrs/srs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/3369
- Loading branch information
Showing
33 changed files
with
456 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ udp-server | |
udp-client | ||
cost | ||
cost.log | ||
thread-join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
g++ thread-join.cpp ../../objs/st/libst.a -g -O0 -o thread-join && ./thread-join | ||
*/ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "../../objs/st/st.h" | ||
|
||
void* pfn(void* arg) { | ||
printf("pid=%d, coroutine is ok\n", ::getpid()); | ||
return NULL; | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
st_init(); | ||
|
||
printf("pid=%d, create coroutine #1\n", ::getpid()); | ||
st_thread_t thread = st_thread_create(pfn, NULL, 1, 0); | ||
st_thread_join(thread, NULL); | ||
|
||
st_usleep(100 * 1000); | ||
|
||
printf("pid=%d, create coroutine #2\n", ::getpid()); | ||
thread = st_thread_create(pfn, NULL, 1, 0); | ||
st_thread_join(thread, NULL); | ||
|
||
st_usleep(100 * 1000); | ||
|
||
printf("pid=%d, create coroutine #3\n", ::getpid()); | ||
thread = st_thread_create(pfn, NULL, 1, 0); | ||
st_thread_join(thread, NULL); | ||
|
||
printf("done\n"); | ||
st_thread_exit(NULL); | ||
return 0; | ||
} | ||
|
Oops, something went wrong.