pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*-   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin.cmod,v 1.103 2003/01/08 14:00:53 grubba Exp $ + || $Id: builtin.cmod,v 1.104 2003/01/08 19:35:42 mast Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "opcodes.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"
pike.git/src/builtin.cmod:309:    *! @[aggregate_multiset()]    *!    */   PIKEFUN multiset(1) mkmultiset(array(1=mixed) a)    efun;    optflags OPT_TRY_OPTIMIZE|OPT_EXTERNAL_DEPEND;   {    RETURN mkmultiset(a);   }    - /*! @decl int trace(int t) + /*! @decl int trace(int trace_level, void|int all_threads)    *!    *! This function changes the debug trace level.    *! -  *! The old level is returned. -  *! +     *! Trace level 1 or higher means that calls to Pike functions are    *! printed to stderr, level 2 or higher means calls to builtin functions    *! are printed, 3 means every opcode interpreted is printed, 4 means    *! arguments to these opcodes are printed as well.    *!    *! See the @tt{-t@} command-line option for more information. -  +  *! +  *! @param trace_level +  *! The new trace level. +  *! +  *! @param all_threads +  *! The trace level is set in all threads if this is nonzero. +  *! Otherwise only the trace level in the current thread is +  *! affected. Setting it in all threads can be useful to track down +  *! deadlock bugs etc. +  *! +  *! @returns +  *! The old level in the current thread is returned.    */ - PIKEFUN int trace(int t) + PIKEFUN int trace(int t, void|int all_threads)    efun;    optflags OPT_SIDE_EFFECT;   {    pop_n_elems(args);    push_int(t_flag); -  + #ifdef PIKE_THREADS +  if (!all_threads || UNSAFE_IS_ZERO (all_threads))    t_flag=t; -  +  else { +  struct thread_state *s; +  FOR_EACH_THREAD(s, s->state.trace_level = t);    } -  + #else +  t_flag=t; + #endif + }      /*! @decl string ctime(int timestamp)    *!    *! Convert the output from a previous call to @[time()] into a readable    *! string containing the current year, month, day and time.    *!    *! Like @[localtime], this function might throw an error if the    *! ctime(2) call failed on the system. It's platform dependent what    *! time ranges that function can handle, e.g. Windows doesn't handle    *! a negative @[timestamp].