| Anonymous | Login | Signup for a new account | 2013-06-19 09:51 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0004104 | OCaml | OCaml general | public | 2006-09-08 21:52 | 2006-09-11 11:18 | ||||||
| Reporter | mottl | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | feature | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 3.09.3 | ||||||||||
| Target Version | Fixed in Version | ||||||||||
| Summary | 0004104: Condition.timedwait missing in threads library | ||||||||||
| Description | The POSIX-standard supports the function pthread_cond_timedwait, which would be very useful for many systems applications. The POSIX-threads version is trivial to write (took me only a few minutes) so it would be great if it could be made part of the standard distribution. I don't know how hard it would be to implement for byte code threads, but most people probably don't care much about the latter anyway so one could just leave it unimplemented for those if it's too time consuming to do right now. | ||||||||||
| Additional Information | The function interface (the function returns false on timeouts): val timedwait : Condition.t -> Mutex.t -> float -> bool Here is the C-stub: CAMLprim value caml_condition_timedwait(value v_cnd, value v_mtx, value v_timeo) { CAMLparam2(v_cnd, v_mtx); int ret; pthread_cond_t *cnd = Condition_val(v_cnd); pthread_mutex_t *mtx = Mutex_val(v_mtx); double timeo = Double_val(v_timeo); struct timespec ts; ts.tv_sec = timeo; ts.tv_nsec = (timeo - ts.tv_sec) * 1e9; enter_blocking_section(); ret = pthread_cond_timedwait(cnd, mtx, &ts); leave_blocking_section(); if (ret == ETIMEDOUT) CAMLreturn(Val_false); caml_pthread_check(ret, "Condition.timedwait"); CAMLreturn(Val_true); } Note that the timeout parameter is an absolute time for good reason (see the man page for this function to know why) so the OCaml-interface should keep this specification. | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2006-09-08 21:52 | mottl | New Issue | |
| 2006-09-11 11:18 | doligez | Status | new => acknowledged |
| Copyright © 2000 - 2011 MantisBT Group |