Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing import statement in UnboundedBlockingQueue.h #1

Open
theoknock opened this issue Aug 15, 2016 · 0 comments
Open

Missing import statement in UnboundedBlockingQueue.h #1

theoknock opened this issue Aug 15, 2016 · 0 comments

Comments

@theoknock
Copy link

Trying to compile the above-referenced file results in a slew of errors, most of them like this:

~/Desktop/ThreadSampleCode/ThreadSampleCode/UnboundedBlockingQueue.m:17:9: Implicit declaration of function 'pthread_mutex_init' is invalid in C99

~/Desktop/ThreadSampleCode/ThreadSampleCode/UnboundedBlockingQueue.m:17:9: Declaration of 'pthread_mutex_init' must be imported from module 'Darwin.POSIX.pthread' before it is required

To fix it, add the following import statement to UnboundedBlockingQueue.h:

#import <pthread.h>

The new header file should now read, in totality:

#import <Foundation/Foundation.h>
#import <pthread.h>
#import <sys/time.h>
#import "Node.h"

@interface UnboundedBlockingQueue : NSObject{
@private
    pthread_mutex_t lock;
    pthread_cond_t notEmpty;
    Node *first, *last;
}

- (UnboundedBlockingQueue*) init;
- (void) put: (id) data;
- (id) take: (int) timeout;

@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant