From owner-freebsd-questions Tue Apr 6 14:30:15 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sucuri.amazon.com.br (sucuri.amazon.com.br [200.241.240.1]) by hub.freebsd.org (Postfix) with ESMTP id 34D1115656 for ; Tue, 6 Apr 1999 14:30:03 -0700 (PDT) (envelope-from aldrin@americasnet.com) Received: from athome.logicStudios.org (root@pm3-s24.amazon.com.br [200.242.245.57]) by sucuri.amazon.com.br (8.9.3/8.9.3) with ESMTP id SAA13087; Tue, 6 Apr 1999 18:28:00 -0300 Received: from athome.logicStudios.org (aldrin@athome.logicStudios.org [10.0.0.1]) by athome.logicStudios.org (8.8.8/8.8.8) with ESMTP id SAA00828; Tue, 6 Apr 1999 18:36:40 -0300 (EST) (envelope-from aldrin@americasnet.com) Date: Tue, 6 Apr 1999 18:36:40 -0300 (EST) From: Aldrin L X-Sender: aldrin@athome.logicStudios.org To: "Brian O'Shea" Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Semaphores In-Reply-To: <19990406113121.J2844@localdomain> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 6 Apr 1999, Brian O'Shea wrote: > There are a few options depending on what you need semaphores for. > If you need process-shared semaphores (ones that can be used to > synchronize multiple processes, as opposed to just threads in the same > process), then you will need to use the SysV semaphore interface (so > you will need to compile a knernel with support for them). I was thinking about some sorta of serialization when writing to a data file. My project is a SNPP (rfc1861) <-> TAP gateway for alphanumeric paging devices. For simplicity and to faster devel., i chose to write is as as an attached process to xinetd. The problem is that i need to write batches of messages, and i think i have to care about its serialization. Or not, if i do it atomically. Does FreeBSD supports the posixen "Atomic Operations"? What about named pipes? Do i have then available under FreeBSD? > If you just need simple binary semaphores to synchronize threads in a > user-threaded process then pthread mutexes may suit your needs. To use > them, include and link against the libc_r library instead > of libc (either with the -lc_r linker option or with the -pthread > compiler option, which is FreeBSD-specific). See the man page on > pthread(3) for an overview of the pthread library functions. This will be considered on a later stage. I just don't want to write the network/daemon handling code now. But later, pthreads sounds like a good idea. :] > p.s. Is there any particular reason for why you don't want to recompile > your kernel? The first: just to know which IPC options i had under freebsd; Secondly: I'm a lazy person. Just want to avoid kernel compiles. But i'll do it, it's just a matter of grabbing and reading the docs. :] Anyway, thanks for your reply. :] done, Aldrin Leal To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message