diff --git a/.gitattributes b/.gitattributes index 9555a0d2ae8d565ef765d9056becd68f7cfaa68c..5b1a8dfd152b4da1c1ffb6e4065600f75275f0d6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -886,7 +886,6 @@ testfont binary /src/svalue.h foreign_ident /src/test_co.pike foreign_ident /src/testsuite.in foreign_ident -/src/threads.c foreign_ident /src/threads.h foreign_ident /src/time_stuff.h foreign_ident /src/tmodule.c foreign_ident diff --git a/src/threads.c b/src/threads.c index 6950350965364400edff09567070c3e8aa6ed50c..e6a046b038922d0f37600e6f92c06fcaa8b2671d 100644 --- a/src/threads.c +++ b/src/threads.c @@ -2,7 +2,7 @@ || 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: threads.c,v 1.259 2008/06/29 12:37:11 nilsson Exp $ +|| $Id$ */ #include "global.h" @@ -1544,6 +1544,25 @@ void exit_mutex_key_obj(struct object *o) } } +static void f_mutex_key__sprintf(INT32 args) +{ + int c = 0; + if(args>0 && TYPEOF(Pike_sp[-args]) == PIKE_T_INT) + c = Pike_sp[-args].u.integer; + pop_n_elems (args); + if(c != 'O') { + push_undefined(); + return; + } + if (THIS_KEY->mutex_obj) { + push_text("MutexKey(/* %O */)"); + ref_push_object(THIS_KEY->mutex_obj); + f_sprintf(2); + } else { + push_text("MutexKey()"); + } +} + /*! @endclass */ @@ -2283,6 +2302,7 @@ void th_init(void) tObjIs_THREAD_ID, T_OBJECT, 0); PIKE_MAP_VARIABLE("_mutex", mutex_key_offset + OFFSETOF(key_storage, mutex_obj), tObjIs_THREAD_MUTEX, T_OBJECT, ID_PROTECTED|ID_PRIVATE); + ADD_FUNCTION("_sprintf",f_mutex_key__sprintf,tFunc(tInt,tStr),ID_PROTECTED); set_init_callback(init_mutex_key_obj); set_exit_callback(exit_mutex_key_obj); mutex_key=Pike_compiler->new_program;