Files
harbour-core/harbour/include/hbthread.ch
Przemyslaw Czerpak c1c574142e 2008-09-21 23:03 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
  * harbour/source/vm/arrays.c
    + added hb_arrayGetPtrGC(), hb_arrayGetSymbol(), hb_arraySetSymbol()

  * harbour/include/hbapi.h
  * harbour/source/vm/dynsym.c
    + added hb_dynsymProtectEval(). Works like hb_dynsymEval() but
      keeps dynamic symbol table locked during whole execution.
      It's faster then hb_dynsymEval() but user function may not
      access dynamic symbol tbale to not cause recursive locks
    + added protection against possible dynamic symbol table resizing
      during hb_dynsymEval() by other threads.

  * harbour/include/hbapi.h
  * harbour/source/vm/memvars.c
    + added hb_memvarSaveInArray( int iScope, BOOL fCopy ) and
      hb_memvarRestoreFromArray( PHB_ITEM pArray )
    % use hb_dynsymProtectEval() in places where it's safe

  * harbour/include/Makefile
  + harbour/include/hbthread.ch
    + added header file with thread constant definitions:
         HB_THREAD_INHERIT_PUBLIC
         HB_THREAD_INHERIT_PRIVATE
         HB_THREAD_INHERIT_MEMVARS
         HB_THREAD_MEMVARS_COPY

  * harbour/include/hbthread.h
  * harbour/source/vm/hvm.c
  * harbour/source/vm/thread.c
    + added support for inheriting visible memvars from current
      thread when new thread is created. Memvars in child thread
      can be shared with parrent or they can be copied. See HB_THREAD_*
      attributes defined in hbthread.ch, f.e.:
         hb_threadStart( HB_THREAD_INHERIT_PUBLIC, @thFunc() )
      or:
         hb_threadStart( HB_BITOR( HB_THREAD_INHERIT_MEMVARS + ;
                                   HB_THREAD_MEMVARS_COPY ), ;
                          @thFunc() )
      Please note that when child thread creates new PUBLIC variable
      which didn't existed when thread was started then it's visible
      only for this thread and optionally for its child threads but
      not for parent thread.
      Please also remember that write access to shared memvars have
      to be protected by users.

  + harbour/tests/mt/mttest08.prg
    + added test code for thread memvars inheritance
2008-09-21 21:04:47 +00:00

64 lines
2.5 KiB
Plaintext

/*
* $Id$
*/
/*
* Harbour Project source code:
* header file with MT mode constant values
*
* Copyright 2008 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* NOTE: This file is also used by C code. */
#ifndef HB_THREAD_CH_
#define HB_THREAD_CH_
#define HB_THREAD_INHERIT_PUBLIC 1
#define HB_THREAD_INHERIT_PRIVATE 2
#define HB_THREAD_INHERIT_MEMVARS 3
#define HB_THREAD_MEMVARS_COPY 4
#endif /* HB_THREAD_CH_ */