return Qnil;
}
+DEFUN ("condition-mutex", Fcondition_mutex, Scondition_mutex, 1, 1, 0,
+ doc: /* Return the mutex associated with CONDITION. */)
+ (Lisp_Object condition)
+{
+ struct Lisp_CondVar *cvar;
+
+ CHECK_CONDVAR (condition);
+ cvar = XCONDVAR (condition);
+
+ return cvar->mutex;
+}
+
+DEFUN ("condition-name", Fcondition_name, Scondition_name, 1, 1, 0,
+ doc: /* Return the name of CONDITION.
+If no name was given when CONDITION was created, return nil. */)
+ (Lisp_Object condition)
+{
+ struct Lisp_CondVar *cvar;
+
+ CHECK_CONDVAR (condition);
+ cvar = XCONDVAR (condition);
+
+ return cvar->name;
+}
+
void
finalize_one_condvar (struct Lisp_CondVar *condvar)
{
defsubr (&Smake_condition_variable);
defsubr (&Scondition_wait);
defsubr (&Scondition_notify);
+ defsubr (&Scondition_mutex);
+ defsubr (&Scondition_name);
Qthreadp = intern_c_string ("threadp");
staticpro (&Qthreadp);
(should (eq (type-of (make-condition-variable (make-mutex)))
'condition-variable)))
+(ert-deftest threads-condvar-mutex ()
+ "simple test of condition-mutex"
+ (should
+ (let ((m (make-mutex)))
+ (eq m (condition-mutex (make-condition-variable m))))))
+
+(ert-deftest threads-condvar-name ()
+ "simple test of condition-name"
+ (should
+ (eq nil (condition-name (make-condition-variable (make-mutex))))))
+
+(ert-deftest threads-condvar-name-2 ()
+ "another simple test of condition-name"
+ (should
+ (string= "hi bob"
+ (condition-name (make-condition-variable (make-mutex)
+ "hi bob")))))
+
;;; threads.el ends here