No smb_raw_search_next in smb_cliraw.h
Stefan (metze) Metzmacher
metze at samba.org
Thu Jul 17 04:10:39 MDT 2014
Am 17.07.2014 11:34, schrieb Stef Bon:
>>> Now with io like fs event change request, it's not possible to make
>>> the requesting thread wait. It should wait forever, causing a blocking
>>> situation.
>>
>> What exactly do you mean with "fs event change" here? What
>> API call do you make to receive those events?
>
> I mean the fs event change calls like in source4/libcli/raw/rawnotify.c,
> sending NT_TRANSACT_NOTIFY_CHANGE.
> I have not implemented this. That is my question howto do this using
> the tevent library.
>
> My point is that with the construction
>
> while ( ! request is done) {
>
> tevent_loop_once(..)
>
> }
>
> it will block the calling thread until the notify request is canceled.
If you're using that, you're using it in a sync fashion.
If you want to use it async there should be only one tevent_context
with tevent_loop_wait().
Note that this code is not thread-safe!.
And code in source4/libcli/raw/ doesn't provide a stable api for
external usage.
This is historically and doesn't use the tevent_req infrastructure yet.
In future we may be able to provide an external async api, but that
requires a lot of work.
Your example should look like this:
struct smbcli_request *notify_req1;
struct smbcli_request *notify_req2;
...
notify_req1 = smb_raw_changenotify_send(tree1, ...);
if (notify_req1 == NULL) {
...
}
notify_req1->async.fn = notify1_done;
notify_req1->async.private_date = ...
...
notify_req2 = smb_raw_changenotify_send(tree2, ...);
if (notify_req2 == NULL) {
...
}
notify_req2->async.fn = notify2_done;
notify_req2->async.private_date = ...
...
ASSERT(tree1->session->transport->ev == tree2->session->transport->ev);
tevent_loop_wait(tree->sesson->transport->ev);
...
static void notify1_done(struct smbcli_request *req)
{
...
status = smb_raw_changenotify_recv(req, ...);
....
}
static void notify2_done(struct smbcli_request *req)
{
...
status = smb_raw_changenotify_recv(req, ...);
....
}
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 246 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140717/38d94036/attachment.pgp>
More information about the samba-technical
mailing list