[libdispatch-dev] State of the Linux port (without blocks support)
Mario Schwalbe
schwalbe at inf.tu-dresden.de
Mon Nov 23 04:51:05 PST 2009
Hi,
Robert Watson schrieb:
> On Thu, 19 Nov 2009, Mario Schwalbe wrote:
>> dispatch_starfish: fail
>> laps 10-1 pass, but the task doesn't return and spins forever (one
>> thread).
>
> I see frequent failed latency deadlines on FreeBSD with this, but have
> mostly been testing on a VM that may be part of the problem for me. All
> the functional tests complete, and the total realtime clock is 17(ish)
> seconds on the VM.
I traced down the problem to the following short test (similar to dispatch_api):
#include <dispatch/dispatch.h>
#include <stdio.h>
#include "dispatch_test.h"
void
work(void *context __attribute__((unused)))
{
printf("[PASS] doing some work\n");
test_stop();
}
int
main(void)
{
test_start("Dispatch After");
//dispatch_queue_t default_q = dispatch_get_global_queue(0, 0);
//test_ptr_notnull("dispatch_get_global_queue", default_q);
//// work all:
//dispatch_after_f(DISPATCH_TIME_NOW, default_q, NULL, work);
//dispatch_after_f(dispatch_time(DISPATCH_TIME_NOW, 0), default_q, NULL, work);
//dispatch_after_f(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), default_q, NULL, work);
dispatch_queue_t main_q = dispatch_get_main_queue();
test_ptr_notnull("dispatch_get_main_queue", main_q);
// works:
//dispatch_after_f(DISPATCH_TIME_NOW, main_q, NULL, work);
//dispatch_after_f(dispatch_time(DISPATCH_TIME_NOW, 0), main_q, NULL, work);
// doesn't work:
dispatch_after_f(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), main_q, NULL, work);
dispatch_main();
return 0;
}
those dispatch_after_f calls that are commented out, do work. however, the last one, results
in _dispatch_wakeup to be called endlessly which tries to get the lock, fails, and returns NULL.
ciao,
Mario
More information about the libdispatch-dev
mailing list