Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24212 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44465 invoked by uid 1010); 25 Jun 2006 21:45:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 44449 invoked from network); 25 Jun 2006 21:45:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jun 2006 21:45:11 -0000 X-PHP-List-Original-Sender: an.dromeda@btconnect.com X-Host-Fingerprint: 194.73.73.227 c2bthomr11.btconnect.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from ([194.73.73.227:2654] helo=c2bthomr11.btconnect.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 13/7C-02438-1E30F944 for ; Sun, 25 Jun 2006 17:45:08 -0400 Received: from va517slx (host81-134-171-156.in-addr.btopenworld.com [81.134.171.156]) by c2bthomr11.btconnect.com (MOS 3.7.4b-GA) with ESMTP id AWO24696; Sun, 25 Jun 2006 22:39:37 +0100 (BST) To: internals@lists.php.net Date: Sun, 25 Jun 2006 22:45:02 +0100 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200606252245.02468.an.dromeda@btconnect.com> Subject: Streams and Threads under Php From: an.dromeda@btconnect.com ("Andrew Mather (BT Std)") I have a C++ based php-extension accessing a C++ based non-php .so data engine, which reads and writes using the open/read/write/close calls in fcntl.h. The non-php engine is reliable away from php, but when accessed via the php extension, it works, but runs into two forms of errors: a) seek/read/write errors - one moment it reads fine, the next it fails. b) data corruption/variable switching - looks like variables are getting confused as to their appropriate value, which smacks of a threading issue. Regarding a) streams: Must any file access either in an extension directly, or in a library or .so object called by that extension, use php streams, to be safe? Or is there a way to allow them to use native system calls, without the strange errors? Regarding b) threads: Is there a useful reference as to the threading model in zend/php, and/or its relation to the apache threading model? Cheers, Andrew.