- File:
-
- 1 edited
-
libcfa/src/concurrency/kernel.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
r1c40091 r27f5f71 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 21 16:46:59201913 // Update Count : 2712 // Last Modified On : Fri Nov 29 17:59:16 2019 13 // Update Count : 35 14 14 // 15 15 … … 26 26 #include <signal.h> 27 27 #include <unistd.h> 28 #include <limits.h> // PTHREAD_STACK_MIN 28 29 } 29 30 … … 133 134 NULL, 134 135 NULL, 135 { 1, false, false } 136 { NULL, 1, false, false }, 137 6u //this should be seeded better but due to a bug calling rdtsc doesn't work 136 138 }; 137 139 … … 232 234 233 235 pthread_join( kernel_thread, NULL ); 236 free( this.stack ); 234 237 } 235 238 … … 260 263 //Main of the processor contexts 261 264 void main(processorCtx_t & runner) { 265 // Because of a bug, we couldn't initialized the seed on construction 266 // Do it here 267 kernelTLS.rand_seed ^= rdtscl(); 268 262 269 processor * this = runner.proc; 263 270 verify(this); … … 440 447 __cfaabi_dbg_print_safe("Kernel : Starting core %p\n", this); 441 448 442 pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this ); 449 pthread_attr_t attr; 450 int ret; 451 ret = pthread_attr_init( &attr ); // initialize attribute 452 if ( ret ) { 453 abort( "%s : internal error, pthread_attr_init failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) ); 454 } // if 455 456 size_t stacksize; 457 ret = pthread_attr_getstacksize( &attr, &stacksize ); // default stack size, normally defined by shell limit 458 if ( ret ) { 459 abort( "%s : internal error, pthread_attr_getstacksize failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) ); 460 } // if 461 assert( stacksize >= PTHREAD_STACK_MIN ); 462 463 this->stack = malloc( stacksize ); 464 ret = pthread_attr_setstack( &attr, this->stack, stacksize ); 465 if ( ret ) { 466 abort( "%s : internal error, pthread_attr_setstack failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) ); 467 } // if 468 469 ret = pthread_create( &this->kernel_thread, &attr, CtxInvokeProcessor, (void *)this ); 470 if ( ret ) { 471 abort( "%s : internal error, pthread_create failed, error(%d) %s.", __PRETTY_FUNCTION__, ret, strerror( ret ) ); 472 } // if 473 // pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this ); 443 474 444 475 __cfaabi_dbg_print_safe("Kernel : core %p started\n", this);
Note:
See TracChangeset
for help on using the changeset viewer.