"Go language Programming" [4.4 Concurrent Communication] Code THREAD.C and Thread.go error

Source: Internet
Author: User

THREAD.C program Pthread_create function The third parameter is the starting address of the thread function, there is no add function, the source code is as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/57/76/wKiom1SaiH_BoPKlAADUU3OTYJ8972.jpg "title=" 2014-12-24 16:56:36 screen. png "alt=" wkiom1saih_bopklaaduu3otyj8972.jpg "/>

THREAD.C will report an undeclared error at compile time:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/57/76/wKiom1SajCTCUDHBAAE0_xQ4Rqs094.jpg "title=" 2014-12-24 17:49:04 screen. png "alt=" wkiom1sajctcudhbaae0_xq4rqs094.jpg "/>

Based on the context, it should be count, replaced by the following:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/57/76/wKiom1SajYLBhAM4AADBIuTlF24768.jpg "title=" 2014-12-24 17:55:00 screen. png "alt=" wkiom1sajylbham4aadbiutlf24768.jpg "/>

Recompile, GCC compile at the last add parameter-lpthread, otherwise the compiler

Pthread_create and pthread_join non-defined references as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/57/76/wKiom1SajP6DI8G3AAFTRGH58Ps468.jpg "title=" 2014-12-24 17:52:50 screen. png "alt=" wkiom1sajp6di8g3aaftrgh58ps468.jpg "/>

Should be at the end of the line to add-lpthread compile, compile the command correctly:

Gcc-lpthread Thread.c-o Main

The THREAD.GO program has no z variables and should be counter:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/57/74/wKioL1SalIbhm5-iAABZir4h82A627.jpg "title=" 2014-12-24 18:20:22 screen. png "alt=" wkiol1salibhm5-iaabzir4h82a627.jpg "/>

This article is from the "Pine" blog, be sure to keep this source http://dongsong.blog.51cto.com/916653/1595611

"Go language Programming" [4.4 Concurrent Communication] Code THREAD.C and Thread.go error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.