Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 讨论

Has anyone else had problems with POSIX threads?

Altera_Forum
名誉分销商 II
3,831 次查看

Hi 

 

I have made an app with 2 POSIX threads for my linux kernel(2.6 microtronix). When I establish my 2 pthread_t varibles the kernel simply reboots. The uClibC has built in support for POSIX threads, so I don't really understand why it has problems with establishing these varibles(I don't even create the threads). 

 

Regards 

GreateWhite.DK
0 项奖励
23 回复数
Altera_Forum
名誉分销商 II
223 次查看

Hi, 

 

I thought your problem was not related to pthreads (the last example you passed to me had all pthread stuff commented out). If you want to use pthread, your previous Makefile is not enough. You need to tell the linker to link the pthread library, and it must appear before the C library, otherwise the dummies in C library will be linked in. Please add the following line to your Makefile: 

 

LDLIBS:=-lpthread $(LDLIBS) 

 

I tried your program several times, did not find any problems, and here is the output: 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

################################## 

Will now allocate 8096 bytes 

 

********************************** 

8096 bytes allocated 

Will now create threads!!! 

1! 

Thread One created!!! 

Thread 1 

Thread 2 

Thread 1 returns: 31916302 

Thread 2 returns: 0[/b] 

--- Quote End ---  

 

 

wentao
0 项奖励
Altera_Forum
名誉分销商 II
223 次查看

Hi Wentao 

 

I have finally gotten the threads running now. I just thought that the pthread support was automatically supported when the ulibc was used. 

But many many thanks wentao you are a lifesaver. The champagne bottles are popping here http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif  

 

BEST REGARDS 

GreateWhite.DK
0 项奖励
Altera_Forum
名誉分销商 II
223 次查看

Hi GreateWhite.DK

 

You are welcome, I am happy to know that problem is gone.  

 

Regards, 

wentao
0 项奖励
回复