File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,7 +183,9 @@ static void thread_init(void)
183183 ring_init (& local -> dead );
184184
185185#ifdef THREAD_LOCAL_DYNAMIC
186+ # if defined(_WIN32 ) || defined(_WIN64 )
186187 pthread_fkey_create ();
188+ # endif
187189
188190 if (pthread_setspecific (__fiber_key , local ) != 0 ) {
189191 printf ("pthread_setspecific error!\r\n" );
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ static void usage(const char* procname) {
4949 , procname);
5050}
5151
52+ #ifdef _TEST
5253static void fiber_main (ACL_FIBER *, void *) {
5354 printf (" hello world!\r\n " );
5455 acl::fiber::delay (100 );
@@ -61,6 +62,7 @@ static void test() {
6162 printf (" Bye!\r\n " );
6263 }
6364}
65+ #endif
6466
6567int main (int argc, char *argv[]) {
6668 int ch, nfiber = 1 , count = 100 ;
@@ -69,7 +71,18 @@ int main(int argc, char *argv[]) {
6971 acl::acl_cpp_init ();
7072 acl::log::stdout_open (true );
7173
74+ #ifdef _TEST
75+ # if defined(_WIN32) || defined(_WIN64)
7276 test ();
77+ return 0 ;
78+ # else
79+ std::thread thr ([] {
80+ test ();
81+ });
82+ thr.join ();
83+ return 0 ;
84+ # endif
85+ #endif
7386
7487 while ((ch = getopt (argc, argv, " he:s:c:n:" )) > 0 ) {
7588 switch (ch) {
You can’t perform that action at this time.
0 commit comments