From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9466 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add sched_getcpu Date: Fri, 4 Mar 2016 18:33:24 -0500 Message-ID: <20160304233324.GB9349@brightrain.aerifal.cx> References: <1456764572-18648-1-git-send-email-nathan@nathan7.eu> <1456780194.12169.25.camel@xiaoka.com> <20160229213057.GE9349@brightrain.aerifal.cx> <1456864521.12169.35.camel@xiaoka.com> <20160301223419.GL9349@brightrain.aerifal.cx> <1456951613.12169.42.camel@xiaoka.com> <20160302211924.GI29662@port70.net> <20160302232635.GP9349@brightrain.aerifal.cx> <1457130109.10711.8.camel@xiaoka.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1457134427 18078 80.91.229.3 (4 Mar 2016 23:33:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Mar 2016 23:33:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9479-gllmg-musl=m.gmane.org@lists.openwall.com Sat Mar 05 00:33:42 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1abzE6-0001OD-8e for gllmg-musl@m.gmane.org; Sat, 05 Mar 2016 00:33:42 +0100 Original-Received: (qmail 28502 invoked by uid 550); 4 Mar 2016 23:33:39 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28475 invoked from network); 4 Mar 2016 23:33:38 -0000 Content-Disposition: inline In-Reply-To: <1457130109.10711.8.camel@xiaoka.com> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:9466 Archived-At: On Fri, Mar 04, 2016 at 11:21:49PM +0100, Tomasz Sterna wrote: > W dniu 02.03.2016, śro o godzinie 18∶26 -0500, użytkownik Rich Felker > napisał: > > The only safe way to make your own threads is to refrain from using > > libc at all and do your own syscalls. Even calling syscall() may not > > be safe (on i386/glibc it probably uses the vdso syscall pointer from > > TLS); you really need to use asm to make the syscall. > > I understand. > Thank you for explaining. > > > > Is there a reason "pthreads is not a good way to do it"? > > The thread API I am implementing differs much to pthreads, which > required a lot of glue code translating one API to another and felt > hand wrenching. Are you sure? The only functions you really need to use pthreads are pthread_create and one of either pthread_join or pthread_detach. Beyond that, how you do your synchronization is up to you; the standard functions are convenient but you're free to roll your own in terms of atomics and futex or whatever. Rich