Guidelines For Posting Here


Login or Register for Dates, Times and to Reply

 
Thread Tools
# 1  
Guidelines For Posting Here

This area is not for technical questions. It is reserved for unregistered users who have a question or registered users who have trouble with their account.

Other posts will be deleted by the moderators.
This User Gave Thanks to Neo For This Post:
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Programming guidelines and style

Hello all, I would like to know if there is a generally accepted unix shell programming Guideline? Do you have any idea where to find this? There are a lot of programming Guidelines to find over Google, but is there one who is generally accepted? (3 Replies)
Discussion started by: API
3 Replies

2. Shell Programming and Scripting

Unix Shell Scripting Guidelines

Hi, I was wondering if any of you guys have developed shell scripting guidelines for writing unix shell scripts effectively. This includes naming standards, comments, indentation, error handing after unix comands, use of exported variables, sending notifications, functions, logging etc... ... (2 Replies)
Discussion started by: acheepi
2 Replies

3. What is on Your Mind?

Guidelines for Posting Here

This area is not for forum specific technical questions. Please post forum specific technical questions in the best forum, not in the lounge. However, if your idea or question is not covered clearly in a forum, please post it here. Discuss whatever is on your mind. Technical topics welcome... (0 Replies)
Discussion started by: Neo
0 Replies
SEMA(9) 						   BSD Kernel Developer's Manual						   SEMA(9)

NAME
sema, sema_init, sema_destroy, sema_post, sema_wait, sema_timedwait, sema_trywait, sema_value -- kernel counting semaphore SYNOPSIS
#include <sys/types.h> #include <sys/lock.h> #include <sys/sema.h> void sema_init(struct sema *sema, int value, const char *description); void sema_destroy(struct sema *sema); void sema_post(struct sema *sema); void sema_wait(struct sema *sema); int sema_timedwait(struct sema *sema, int timo); int sema_trywait(struct sema *sema); int sema_value(struct sema *sema); DESCRIPTION
Counting semaphores provide a mechanism for synchronizing access to a pool of resources. Unlike mutexes, semaphores do not have the concept of an owner, so they can also be useful in situations where one thread needs to acquire a resource, and another thread needs to release it. Each semaphore has an integer value associated with it. Posting (incrementing) always succeeds, but waiting (decrementing) can only success- fully complete if the resulting value of the semaphore is greater than or equal to zero. Semaphores should not be used where mutexes and condition variables will suffice. Semaphores are a more complex synchronization mechanism than mutexes and condition variables, and are not as efficient. Semaphores are created with sema_init(), where sema is a pointer to space for a struct sema, value is the initial value of the semaphore, and description is a pointer to a null-terminated character string that describes the semaphore. Semaphores are destroyed with sema_destroy(). A semaphore is posted (incremented) with sema_post(). A semaphore is waited on (decremented) with sema_wait(), sema_timedwait(), or sema_trywait(). The timo argument to sema_timedwait() specifies the minimum time in ticks to wait before returning with failure. sema_value() is used to read the current value of the semaphore. RETURN VALUES
The sema_value() function returns the current value of the semaphore. If decrementing the semaphore would result in its value being negative, sema_trywait() returns 0 to indicate failure. Otherwise, a non-zero value is returned to indicate success. The sema_timedwait() function returns 0 if waiting on the semaphore succeeded; otherwise a non-zero error code is returned. ERRORS
The sema_timedwait() function will fail if: [EWOULDBLOCK] Timeout expired. SEE ALSO
condvar(9), locking(9), mtx_pool(9), mutex(9), rwlock(9), sx(9) BSD
February 1, 2006 BSD

Featured Tech Videos