From owner-state-threads@oss.sgi.com Sat Nov 4 11:44:50 2000 Received: by oss.sgi.com id ; Sat, 4 Nov 2000 11:44:30 -0800 Received: from femail6.sdc1.sfba.home.com ([24.0.95.86]:36857 "EHLO femail6.sdc1.sfba.home.com") by oss.sgi.com with ESMTP id ; Sat, 4 Nov 2000 11:44:07 -0800 Received: from home.com ([24.11.49.110]) by femail6.sdc1.sfba.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20001104194407.ZACV2410.femail6.sdc1.sfba.home.com@home.com> for ; Sat, 4 Nov 2000 11:44:07 -0800 Message-ID: <3A046702.1E928441@home.com> Date: Sat, 04 Nov 2000 14:44:02 -0500 From: Danil Melomedman X-Mailer: Mozilla 4.73 [en] (X11; I; Linux 2.4.0-test9 i586) X-Accept-Language: en, ru MIME-Version: 1.0 To: state-threads@oss.sgi.com Subject: Need examples for file I/O using st. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-state-threads@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;state-threads-outgoing Hi. Wonder if there are some code examples or snippets available to do scalable file i/o using state threads? Also something like reading a text file and counting characters in the most efficient manner possible would be great (POP3 servers and FTP servers do this all the time, but usually do it very slowly character by character). Thanks. From owner-state-threads@oss.sgi.com Mon Nov 13 17:42:13 2000 Received: by oss.sgi.com id ; Mon, 13 Nov 2000 17:42:04 -0800 Received: from femail7.sdc1.sfba.home.com ([24.0.95.87]:18568 "EHLO femail7.sdc1.sfba.home.com") by oss.sgi.com with ESMTP id ; Mon, 13 Nov 2000 17:41:40 -0800 Received: from home.com ([24.11.49.110]) by femail7.sdc1.sfba.home.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20001114014135.JNSW2350.femail7.sdc1.sfba.home.com@home.com> for ; Mon, 13 Nov 2000 17:41:35 -0800 Message-ID: <3A109841.94B84A45@home.com> Date: Mon, 13 Nov 2000 20:41:21 -0500 From: Danil Melomedman X-Mailer: Mozilla 4.73 [en] (X11; I; Linux 2.4.0-test9 i586) X-Accept-Language: en, ru MIME-Version: 1.0 To: state-threads@oss.sgi.com Subject: Private Data Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-state-threads@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;state-threads-outgoing I am putting together a POP3 server. It allocates a structure per message, all those structures must be private. There's also an array of pointers to those structs (should also be private). What would be a good approach to use st_thread_setspecific() so that none of the structures are damaged? Do I need a key per malloced struct? I can see how one struct can easily be privatized, but can't imagine a good way to do it with many dynamically allocated structs. Help would be greately appreciated. Regards. -- Dan From owner-state-threads@oss.sgi.com Tue Nov 14 10:10:28 2000 Received: by oss.sgi.com id ; Tue, 14 Nov 2000 10:10:08 -0800 Received: from deliverator.sgi.com ([204.94.214.10]:23375 "EHLO deliverator.sgi.com") by oss.sgi.com with ESMTP id ; Tue, 14 Nov 2000 10:09:47 -0800 Received: from trudge.engr.sgi.com (trudge.engr.sgi.com [163.154.38.51]) by deliverator.sgi.com (980309.SGI.8.8.8-aspam-6.2/980310.SGI-aspam) via ESMTP id KAA13181 for ; Tue, 14 Nov 2000 10:01:55 -0800 (PST) mail_from (mja@trudge.engr.sgi.com) Received: (from mja@localhost) by trudge.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF) id KAA10962 for state-threads@oss.sgi.com; Tue, 14 Nov 2000 10:07:46 -0800 (PST) From: mja@trudge.engr.sgi.com (Mike Abbott) Message-Id: <200011141807.KAA10962@trudge.engr.sgi.com> Subject: Re: Private Data To: state-threads@oss.sgi.com Date: Tue, 14 Nov 2000 10:07:46 -0800 (PST) In-Reply-To: <3A109841.94B84A45@home.com> from "Danil Melomedman" at Nov 13, 2000 08:41:21 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-state-threads@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;state-threads-outgoing > I am putting together a POP3 server. It allocates a structure per > message, all those structures must be private. There's also an array of > pointers to those structs (should also be private). What would be a good > approach to use st_thread_setspecific() so that none of the structures > are damaged? State threads share an address space so there's no way to protect one thread's "private" data from accidental or malicious damage by another thread. The only way to prevent such damage is to use separate address spaces which usually implies separate processes. However, this usually isn't necessary. > Do I need a key per malloced struct? Impractical. There are only 16 keys in the default distribution (ST_KEYS_MAX) so you'd quickly run out. Instead use just one key to store a pointer to a structure that contains all of the data (and/or pointers to additional data) for one thread. All the data is out there; each thread just needs a unique starting point for wading through it. -- Michael J. Abbott mja@sgi.com http://reality.sgi.com/mja/