aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/thread.c b/src/thread.c
index 80557e5d5ee..9ec418f9871 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -39,16 +39,9 @@ Lisp_Object Qthreadp, Qmutexp;
39 39
40 40
41 41
42struct Lisp_Mutex 42DEFUN ("make-mutex", Fmake_mutex, Smake_mutex, 0, 1, 0,
43{
44 struct vectorlike_header header;
45
46 lisp_mutex_t mutex;
47};
48
49DEFUN ("make-mutex", Fmake_mutex, Smake_mutex, 0, 0, 0,
50 doc: /* FIXME */) 43 doc: /* FIXME */)
51 (void) 44 (Lisp_Object name)
52{ 45{
53 struct Lisp_Mutex *mutex; 46 struct Lisp_Mutex *mutex;
54 Lisp_Object result; 47 Lisp_Object result;
@@ -57,6 +50,7 @@ DEFUN ("make-mutex", Fmake_mutex, Smake_mutex, 0, 0, 0,
57 memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex), 50 memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex),
58 0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex, 51 0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex,
59 mutex)); 52 mutex));
53 mutex->name = name;
60 lisp_mutex_init (&mutex->mutex); 54 lisp_mutex_init (&mutex->mutex);
61 55
62 XSETMUTEX (result, mutex); 56 XSETMUTEX (result, mutex);
@@ -107,6 +101,18 @@ DEFUN ("mutex-unlock", Fmutex_unlock, Smutex_unlock, 1, 1, 0,
107 return Qnil; 101 return Qnil;
108} 102}
109 103
104DEFUN ("mutex-name", Fmutex_name, Smutex_name, 1, 1, 0,
105 doc: /* FIXME */)
106 (Lisp_Object obj)
107{
108 struct Lisp_Mutex *mutex;
109
110 CHECK_MUTEX (obj);
111 mutex = XMUTEX (obj);
112
113 return mutex->name;
114}
115
110void 116void
111finalize_one_mutex (struct Lisp_Mutex *mutex) 117finalize_one_mutex (struct Lisp_Mutex *mutex)
112{ 118{
@@ -542,6 +548,7 @@ syms_of_threads (void)
542 defsubr (&Smake_mutex); 548 defsubr (&Smake_mutex);
543 defsubr (&Smutex_lock); 549 defsubr (&Smutex_lock);
544 defsubr (&Smutex_unlock); 550 defsubr (&Smutex_unlock);
551 defsubr (&Smutex_name);
545 552
546 Qthreadp = intern_c_string ("threadp"); 553 Qthreadp = intern_c_string ("threadp");
547 staticpro (&Qthreadp); 554 staticpro (&Qthreadp);