Problem with semaphore_wait & its correct usage.
Problem with semaphore_wait & its correct usage.
- Subject: Problem with semaphore_wait & its correct usage.
- From: JanakiRam <email@hidden>
- Date: Tue, 7 Aug 2007 08:31:16 +0530
Hi ALL,
I'm writing a kext driver , using semaphore calls. My
application is hanging when the semaphore_wait is executed.But this is
not consistent.
I'm fairly new to this semaphores usage in Mac.
Can any one clarify my following queries.
i) Is there any difference in Semaphores implementation in
Mac and other Unix flavours.
ii) Is there any difference in Semaphores implementation from
Mac OS 10.3 to 10.4
iii) Semaphores implementation is based on processor
scheduling in Mac ?. I facing weird behaviour of app in G5 where as it
is running correctly in G4.
iv) i know that POSIX Semaphores are available in Mac. How
the user level semaphores ( such as sem_wait) is different from Kernel
level ones ?
v) Is the following code usage of semaphore_wait correct ?
kern_return_ DeviceDriver_start (kmod_info_t * ki, void * d) {
printf("DeviceDriver_start called\n");
result =
semaphore_create(current_task(),&mysemaphore,SYNC_POLICY_FIXED_PRIORITY,1);
return KERN_SUCCESS;
}
kern_return_t DeviceDriver_stop (kmod_info_t * ki, void * d) {
result = semaphore_destroy(current_task(),&mysemaphore);
return KERN_SUCCESS;
}
static int hook_function(struct vop_args *a) {
semaphore_wait(&mysemaphore);
// custom hook implementation
semaphore_signal(s->sem);
return 0;
}
Please help me to solve it. Thanks in Advance.
-JanakiRam.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden