aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.c
diff options
context:
space:
mode:
authorEli Zaretskii2016-12-10 11:31:11 +0200
committerEli Zaretskii2016-12-10 11:31:11 +0200
commitc364d62f89a499d22f06f63e81ec7819f51596fa (patch)
tree00f04506a0e7ed9830127592fb2df46fbd6808b2 /src/thread.c
parente4df093e6058c4338a1ea885d44fd0be7f032b8c (diff)
downloademacs-c364d62f89a499d22f06f63e81ec7819f51596fa.tar.gz
emacs-c364d62f89a499d22f06f63e81ec7819f51596fa.zip
Improve doc strings in thread.c
* src/thread.c (Fmake_condition_variable, Fcondition_wait) (Fcondition_notify, Fcondition_mutex, Fcondition_name, Fmake_thread) (Fthread_join, Fall_threads): Doc fixes.
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/src/thread.c b/src/thread.c
index b2f8561f923..ee5b82da905 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -301,7 +301,7 @@ finalize_one_mutex (struct Lisp_Mutex *mutex)
301DEFUN ("make-condition-variable", 301DEFUN ("make-condition-variable",
302 Fmake_condition_variable, Smake_condition_variable, 302 Fmake_condition_variable, Smake_condition_variable,
303 1, 2, 0, 303 1, 2, 0,
304 doc: /* Make a condition variable. 304 doc: /* Make a condition variable associated with MUTEX.
305A condition variable provides a way for a thread to sleep while 305A condition variable provides a way for a thread to sleep while
306waiting for a state change. 306waiting for a state change.
307 307
@@ -355,23 +355,23 @@ condition_wait_callback (void *arg)
355} 355}
356 356
357DEFUN ("condition-wait", Fcondition_wait, Scondition_wait, 1, 1, 0, 357DEFUN ("condition-wait", Fcondition_wait, Scondition_wait, 1, 1, 0,
358 doc: /* Wait for the condition variable to be notified. 358 doc: /* Wait for the condition variable COND to be notified.
359CONDITION is the condition variable to wait on. 359COND is the condition variable to wait on.
360 360
361The mutex associated with CONDITION must be held when this is called. 361The mutex associated with COND must be held when this is called.
362It is an error if it is not held. 362It is an error if it is not held.
363 363
364This releases the mutex and waits for CONDITION to be notified or for 364This releases the mutex and waits for COND to be notified or for
365this thread to be signalled with `thread-signal'. When 365this thread to be signalled with `thread-signal'. When
366`condition-wait' returns, the mutex will again be locked by this 366`condition-wait' returns, COND's mutex will again be locked by
367thread. */) 367this thread. */)
368 (Lisp_Object condition) 368 (Lisp_Object cond)
369{ 369{
370 struct Lisp_CondVar *cvar; 370 struct Lisp_CondVar *cvar;
371 struct Lisp_Mutex *mutex; 371 struct Lisp_Mutex *mutex;
372 372
373 CHECK_CONDVAR (condition); 373 CHECK_CONDVAR (cond);
374 cvar = XCONDVAR (condition); 374 cvar = XCONDVAR (cond);
375 375
376 mutex = XMUTEX (cvar->mutex); 376 mutex = XMUTEX (cvar->mutex);
377 if (!lisp_mutex_owned_p (&mutex->mutex)) 377 if (!lisp_mutex_owned_p (&mutex->mutex))
@@ -409,24 +409,24 @@ condition_notify_callback (void *arg)
409} 409}
410 410
411DEFUN ("condition-notify", Fcondition_notify, Scondition_notify, 1, 2, 0, 411DEFUN ("condition-notify", Fcondition_notify, Scondition_notify, 1, 2, 0,
412 doc: /* Notify a condition variable. 412 doc: /* Notify COND, a condition variable.
413This wakes a thread waiting on CONDITION. 413This wakes a thread waiting on COND.
414If ALL is non-nil, all waiting threads are awoken. 414If ALL is non-nil, all waiting threads are awoken.
415 415
416The mutex associated with CONDITION must be held when this is called. 416The mutex associated with COND must be held when this is called.
417It is an error if it is not held. 417It is an error if it is not held.
418 418
419This releases the mutex when notifying CONDITION. When 419This releases COND's mutex when notifying COND. When
420`condition-notify' returns, the mutex will again be locked by this 420`condition-notify' returns, the mutex will again be locked by this
421thread. */) 421thread. */)
422 (Lisp_Object condition, Lisp_Object all) 422 (Lisp_Object cond, Lisp_Object all)
423{ 423{
424 struct Lisp_CondVar *cvar; 424 struct Lisp_CondVar *cvar;
425 struct Lisp_Mutex *mutex; 425 struct Lisp_Mutex *mutex;
426 struct notify_args args; 426 struct notify_args args;
427 427
428 CHECK_CONDVAR (condition); 428 CHECK_CONDVAR (cond);
429 cvar = XCONDVAR (condition); 429 cvar = XCONDVAR (cond);
430 430
431 mutex = XMUTEX (cvar->mutex); 431 mutex = XMUTEX (cvar->mutex);
432 if (!lisp_mutex_owned_p (&mutex->mutex)) 432 if (!lisp_mutex_owned_p (&mutex->mutex))
@@ -440,26 +440,26 @@ thread. */)
440} 440}
441 441
442DEFUN ("condition-mutex", Fcondition_mutex, Scondition_mutex, 1, 1, 0, 442DEFUN ("condition-mutex", Fcondition_mutex, Scondition_mutex, 1, 1, 0,
443 doc: /* Return the mutex associated with CONDITION. */) 443 doc: /* Return the mutex associated with condition variable COND. */)
444 (Lisp_Object condition) 444 (Lisp_Object cond)
445{ 445{
446 struct Lisp_CondVar *cvar; 446 struct Lisp_CondVar *cvar;
447 447
448 CHECK_CONDVAR (condition); 448 CHECK_CONDVAR (cond);
449 cvar = XCONDVAR (condition); 449 cvar = XCONDVAR (cond);
450 450
451 return cvar->mutex; 451 return cvar->mutex;
452} 452}
453 453
454DEFUN ("condition-name", Fcondition_name, Scondition_name, 1, 1, 0, 454DEFUN ("condition-name", Fcondition_name, Scondition_name, 1, 1, 0,
455 doc: /* Return the name of CONDITION. 455 doc: /* Return the name of condition variable COND.
456If no name was given when CONDITION was created, return nil. */) 456If no name was given when COND was created, return nil. */)
457 (Lisp_Object condition) 457 (Lisp_Object cond)
458{ 458{
459 struct Lisp_CondVar *cvar; 459 struct Lisp_CondVar *cvar;
460 460
461 CHECK_CONDVAR (condition); 461 CHECK_CONDVAR (cond);
462 cvar = XCONDVAR (condition); 462 cvar = XCONDVAR (cond);
463 463
464 return cvar->name; 464 return cvar->name;
465} 465}
@@ -678,7 +678,7 @@ finalize_one_thread (struct thread_state *state)
678DEFUN ("make-thread", Fmake_thread, Smake_thread, 1, 2, 0, 678DEFUN ("make-thread", Fmake_thread, Smake_thread, 1, 2, 0,
679 doc: /* Start a new thread and run FUNCTION in it. 679 doc: /* Start a new thread and run FUNCTION in it.
680When the function exits, the thread dies. 680When the function exits, the thread dies.
681If NAME is given, it names the new thread. */) 681If NAME is given, it must be a string; it names the new thread. */)
682 (Lisp_Object function, Lisp_Object name) 682 (Lisp_Object function, Lisp_Object name)
683{ 683{
684 sys_thread_t thr; 684 sys_thread_t thr;
@@ -843,8 +843,9 @@ thread_join_callback (void *arg)
843} 843}
844 844
845DEFUN ("thread-join", Fthread_join, Sthread_join, 1, 1, 0, 845DEFUN ("thread-join", Fthread_join, Sthread_join, 1, 1, 0,
846 doc: /* Wait for a thread to exit. 846 doc: /* Wait for THREAD to exit.
847This blocks the current thread until THREAD exits. 847This blocks the current thread until THREAD exits or until
848the current thread is signaled.
848It is an error for a thread to try to join itself. */) 849It is an error for a thread to try to join itself. */)
849 (Lisp_Object thread) 850 (Lisp_Object thread)
850{ 851{
@@ -863,7 +864,7 @@ It is an error for a thread to try to join itself. */)
863} 864}
864 865
865DEFUN ("all-threads", Fall_threads, Sall_threads, 0, 0, 0, 866DEFUN ("all-threads", Fall_threads, Sall_threads, 0, 0, 0,
866 doc: /* Return a list of all threads. */) 867 doc: /* Return a list of all the live threads. */)
867 (void) 868 (void)
868{ 869{
869 Lisp_Object result = Qnil; 870 Lisp_Object result = Qnil;