1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

84 Commits

Author SHA1 Message Date
Volker Lendecke
8a515a2d10 tevent: Add tevent_req_reset_endtime
We might decide at some point that we don't want a request to
time out

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-05 00:06:22 +02:00
Volker Lendecke
0ecefd5bf9 tevent: Add tevent_update_timer()
This will be a quicker way to time out sending sockets in messaging_dgm. Right
now cleanup of out-sockets is a bit coarse. The ideal would be to kill a socket
after being idle n seconds. This would mean to free and re-install a timer on
every packet. tevent_update_timer will be quite a bit cheaper.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-10-05 00:06:21 +02:00
Michael Adam
fee1f4ce15 tevent: fix confused documentation
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Sep  6 23:16:34 CEST 2016 on sn-devel-144
2016-09-06 23:16:34 +02:00
Volker Lendecke
7d33761f42 tevent: Fix some typos
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep  1 05:48:38 CEST 2016 on sn-devel-144
2016-09-01 05:48:37 +02:00
Volker Lendecke
f6aaece578 tevent: Add threaded immediate activation
This is infrastructure to improve our async r/w result handling and latency.
The pthreadpool signalling goes through a pipe. This has downsides: The main
event loop has to go through a read on the pipe before it can ship the result.
Also, it is not guaranteed by poll/epoll that the pthreadpool signal pipe is
handled with top priority. When an async pread/pwrite has finished, we should
immediately ship the result to the client, not waiting for anything else.

This patch enables tevent_immediate structs as job signalling. This means a
busy main tevent loop will handle the threaded job completion before any timed
or file descriptor events. Opposite to Jeremy's tevent_thread_proxy this is
done by a modification of the main event loop by looking at a linked list under
a central mutex.

Regarding performance: In a later commit I've created a test that does nothing
but fire one immediate over and over again. If you add a phread_mutex_lock and
unlock pair in the immediate handler, you lose roughly 25% of rounds per
second, so it is measurable. It is questionable that will be measurable in the
real world, but to counter concerns activation of immediates needs to go
through a new struct tevent_threaded_context. Only if such a
tevent_threaded_context exists for a tevent context, the main loop takes the
hit to look at the mutex'ed list of finished jobs.

This patch by design does not care about talloc hierarchies. The idea is that
the main thread owning the tevent context creates a chunk of memory and
prepares the tevent_immediate indication job completion. The main thread hands
the memory chunk together with the immediate as a job description over to a
helper thread. The helper thread does its job and upon completion calls
tevent_threaded_schedule_immediate with the already-prepared immediate. From
that point on memory ownership is again transferred to the main thread.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-08-24 01:33:48 +02:00
Garming Sam
fa7212afe7 tevent: typo in documentation
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-07-05 00:00:15 +02:00
Douglas Bagnall
a20ee62984 tevent.h: use HAVE___ATTRIBUTE__ instead of __GNUC__
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 15:13:15 +01:00
Jeremy Allison
49bddd8e47 lib: tevent: Initial checkin of threaded tevent context calling code.
Adds 2 new functions:

struct tevent_thread_proxy *tevent_thread_proxy_create(
                struct tevent_context *dest_ev_ctx);

void tevent_thread_proxy_schedule(struct tevent_thread_proxy *tp,
		struct tevent_immediate **pp_im,
		tevent_immediate_handler_t handler,
		void *pp_private_data);

Brief doc included. Tests, docs and tutorial to follow.

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-11-05 18:04:23 +01:00
Stefan Metzmacher
44584f8107 tevent.h: propose tstream_ versions of read_packet_send/recv and writev_send/recv
The functions operating on the raw file descriptor are for advanced callers,
which take extra care and avoid the problems of
https://bugzilla.samba.org/show_bug.cgi?id=11141.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-06-12 17:08:17 +02:00
Stefan Metzmacher
33ca0179ac tevent: add a note to tevent_add_fd()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11141

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-20 19:29:30 +02:00
Stefan Metzmacher
50b9f154d2 tevent: add tevent_req_set_cleanup_fn()
Note that some callers used their own destructor for their
tevent_req instance, they'll just overwrite this,
which is not intended, but works without problems.

The intended way is to specify a cleanup function
and handle the TEVENT_REQ_RECEIVED state as destructor.

Note that the TEVENT_REQ_RECEIVED cleanup event might
be triggered by an explicit tevent_req_received()
in the _recv() function. The TEVENT_REQ_RECEIVED event
is only triggered once as tevent_req_received()
will remove the destructor.

So the difference compared to a custom destructor
is that the struct tevent_req itself can continue
to be there, while tevent_req_received() removed
all internal state.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-01-17 12:38:08 +01:00
Stefan Metzmacher
7502a309e8 tevent: add doxygen comments for tevent_num_signals() and tevent_sa_info_queue_count()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-01-17 12:38:08 +01:00
Volker Lendecke
fd80e54416 tevent: Add prototypes
... doxygen docs to be filled in :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-01-17 12:38:08 +01:00
Gregor Beck
8e44c2f963 tevent: add tevent_queue_wait_send/recv()
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-12-11 22:46:09 +01:00
David Disseldorp
e6f79b9489 tevent: document tevent_req_create state zeroing
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jul  8 20:43:49 CEST 2013 on sn-devel-104
2013-07-08 20:43:49 +02:00
Michael Adam
883d20a9bf tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE
The define TEVENT_HAS_LOOP_ONCE_TRACE_POINTS can be used to
detect the new feature, without writing configure tests.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-03-01 11:59:17 -08:00
Stefan Metzmacher
ba65400c6e tevent: expose tevent_context_init_ops
This can be used to implement wrapper backends,
while passing a private pointer to the backens init function
via ev->additional_data.

metze
2012-06-08 19:00:05 +02:00
Martin Schwenke
796acbd9ff lib/tevent: Add trace point callback
Set/get a single callback function to be invoked at various trace
points.  Define "before wait" and "after wait" trace points - more
trace points can be added later if required.

CTDB wants this to log long waits and events.

Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-08 19:00:05 +02:00
Sumit Bose
ce93b4f464 tevent: fix documentation for tevent_context_init_byname()
Signed-off-by: Simo Sorce <idra@samba.org>

Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Thu Aug 11 21:56:37 CEST 2011 on sn-devel-104
2011-08-11 21:56:37 +02:00
Stefan Metzmacher
c6363bb352 tevent: fix some comments in tevent.h
metze
2011-08-09 21:37:42 +02:00
Stefan Metzmacher
1533f1722d tevent: add tevent_queue_add_entry() and tevent_queue_add_optimize_empty()
This adds more flexible handling for the add operation:

- It allows the caller to remove a tevent_req from the queue
  by calling talloc_free() on the returned tevent_queue_entry.
- It allows the caller to optimize for the empty queue case,
  where it the caller wants to avoid the delay caused by
  the immediate event.

metze
2011-08-09 21:37:41 +02:00
Stefan Metzmacher
aba9d48f55 tevent: allow tevent_queue_add() to take a NULL trigger function
This way the caller can add a blocker to the queue.

metze
2011-08-09 21:37:41 +02:00
Stefan Metzmacher
3c38ec72e7 tevent: add tevent_queue_running() function
metze
2011-08-09 21:37:40 +02:00
Stefan Metzmacher
e5827a4007 tevent: add tevent_req_defer_callback()
metze
2011-07-09 11:02:42 +02:00
Stefan Metzmacher
2a1ebeae19 tevent: fix comments for tevent_req_post()
metze
2011-07-09 11:02:41 +02:00
Volker Lendecke
c2a826b10c tevent: Add tevent_req_oom
This is a replacement for tevent_req_nomem(NULL, req)
2011-06-20 12:33:24 +02:00
Rusty Russell
e340cd83f8 lib/tevent/tevent.h: minor documentation fix.
The usecs arguments are (of course) microseconds, not milliseconds.
This was added by Andreas Schneider in 6c1bcdc2 (tevent: Document the
tevent helper functions.).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Wed Jun  1 11:47:38 CEST 2011 on sn-devel-104
2011-06-01 11:47:38 +02:00
Volker Lendecke
8aab926c28 tevent: Fix a typo
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon May  9 08:17:08 CEST 2011 on sn-devel-104
2011-05-09 08:17:08 +02:00
Andreas Schneider
d4867ef838 tevent: Fixed tevent_wakeup_send code example. 2011-03-09 09:28:27 +01:00
Volker Lendecke
b2c983149c tevent: More documentation updates
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Dec 26 15:49:59 CET 2010 on sn-devel-104
2010-12-26 15:49:59 +01:00
Volker Lendecke
d2de01f95b tevent: More doc fixes
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Dec 26 10:20:51 CET 2010 on sn-devel-104
2010-12-26 10:20:51 +01:00
Volker Lendecke
f16740a408 tevent: Some documentation fixes
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sat Dec 25 23:58:20 CET 2010 on sn-devel-104
2010-12-25 23:58:20 +01:00
Kai Blin
3f43b7e542 tevent: Fix docstring, tevent_req_is_in_progress does not destroy private data
Autobuild-User: Kai Blin <kai@samba.org>
Autobuild-Date: Wed Nov 17 07:23:51 UTC 2010 on sn-devel-104
2010-11-17 07:23:51 +00:00
Andreas Schneider
3addebee34 tevent: Added a description for tevent queue. 2010-05-10 10:28:37 +02:00
Andreas Schneider
239d59feab tevent: Document the tevent_queue functions. 2010-05-05 09:28:04 +02:00
Andreas Schneider
6c1bcdc2e2 tevent: Document the tevent helper functions. 2010-05-05 09:28:04 +02:00
Andreas Schneider
78fbedf369 tevent: Document missing callback typedefs. 2010-05-05 09:28:04 +02:00
Andreas Schneider
a8e575ac22 tevent: Document the missing tevent async request callback functions. 2010-05-05 09:28:04 +02:00
Andreas Schneider
d8a6b23b07 tevent: Create a typedef for the debug function callback. 2010-05-05 09:28:04 +02:00
Stephen Gallagher
e286966bba tevent: Added more documentation. 2010-05-05 09:28:04 +02:00
Stephen Gallagher
098221e886 tevent: Remove erroneous comments about TEVENT_FD_AUTOCLOSE
There is no such flag.
2010-05-05 09:28:04 +02:00
Andreas Schneider
4263983cad tevent: Added basic doxygen documentation. 2010-05-05 09:28:04 +02:00
Andrew Tridgell
5609c50433 tevent: added tevent_re_initialise()
This allows us to re-initialise a tevent context without destroying
the pointer. That means that if someone keeps a long term ptr to the
event context across a fork it will still work.

This also brings the memory handling in single and standard process
models much closer together, which means less bugs that we don't find
with make test.
2010-03-26 21:13:27 +11:00
Brad Hards
119a8230eb Spelling fixes for tevent.
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:32 +01:00
Stefan Metzmacher
45e4be0d96 tevent: add tevent_req_cancel() infrastructure
This offers a generic way for callers to cancel an
async request.

metze
2009-08-17 09:25:44 +02:00
Simo Sorce
30b2014a01 Expose functions need by backend writers
move publicly needed structures and functions in the public header.
Stop installing internal headers.
Update the signature and exports files with the new exposed
function.
2009-07-03 08:45:30 -04:00
Volker Lendecke
c6f39b46a7 Add tevent_req_notify_callback
This is necessary for requests that have multiple results. Examples would be
SMBEcho and ldap_search.
2009-06-04 17:29:48 +02:00
Stefan Metzmacher
9eaf53d98e tevent: store the location where a request was finished
This is very useful to find bugs.
You can use 'p *req' in gdb to show where
tevent_req_done(), tevent_req_error() or tevent_req_nomem()
was called.

metze
2009-03-17 20:17:01 +01:00
Stefan Metzmacher
3a831e4620 tevent: use an immediate event as trigger for tevent_queue
metze
2009-03-17 19:59:09 +01:00
Stefan Metzmacher
66886f8966 tevent: add support for immediate events
They're like directly triggered timed events,
but you can preallocated them and scheduling them
will not fail.

metze
2009-03-17 19:59:00 +01:00