[haiku-commits] Re: r34233 - haiku/trunk/src/system/kernel

On 2009-11-25 at 10:37:31 [+0100], axeld@xxxxxxxxxxxxxxxx wrote:
>  status_t
>  unregister_generic_syscall(const char *subsystem, uint32 version)
>  {
> -    // ToDo: we should only remove the syscall with the matching version
> -    generic_syscall *syscall;
> -    status_t status;
> +    // TODO: we should only remove the syscall with the matching version
>  
> -    mutex_lock(&sGenericSyscallLock);
> +    while (true) {
> +        MutexLocker locker(sGenericSyscallLock);
>  
> -    syscall = find_generic_syscall(subsystem);
> -    if (syscall != NULL) {
> +        generic_syscall* syscall = find_generic_syscall(subsystem);
> +        if (syscall == NULL)
> +            return B_NAME_NOT_FOUND;
> +
> +        if (syscall->use_count != 0) {
> +            // TODO: we could use a condition variable here instead

How lazy... :-P

> +            locker.Unlock();
> +            snooze(6000);
> +            continue;
> +        }
> +

At least a "valid" flag should be introduced. Otherwise the function might 
wait forever, if the generic syscall is called periodically.

CU, Ingo

Other related posts: