Replace scm_make_mutex_with_flags

* libguile/threads.c (enum fat_mutex_kind): New data type, replacing
  separate flags.
  (struct fat_mutex): Adapt.
  (make_fat_mutex): Fat mutexes can only be one of three kinds, not one
  of 4 kinds.  (Recursive unowned mutexes are not a thing.)
  (scm_make_mutex): Adapt.
  (scm_make_mutex_with_kind): New function, replacing
  scm_make_mutex_with_flags.  Still bound to make-mutex.
  (scm_make_recursive_mutex): Adapt.
  (fat_mutex_lock, fat_mutex_unlock): Adapt.
* libguile/threads.h (scm_make_mutex_with_kind): New decl.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_mutex_with_flags): Deprecate.
This commit is contained in:
Andy Wingo 2016-11-05 11:14:17 +01:00
commit 7682461241
4 changed files with 72 additions and 31 deletions

View file

@ -678,6 +678,28 @@ scm_dynwind_critical_section (SCM mutex)
}
SCM
scm_make_mutex_with_flags (SCM flags)
{
SCM kind = SCM_UNDEFINED;
scm_c_issue_deprecation_warning
("'scm_make_mutex_with_flags' is deprecated. "
"Use 'scm_make_mutex_with_kind' instead.");
if (!scm_is_null (flags))
{
if (!scm_is_null (scm_cdr (flags)))
scm_misc_error (NULL, "too many mutex options: ~a", scm_list_1 (flags));
kind = scm_car (flags);
}
return scm_make_mutex_with_kind (kind);
}
void