Had an idea for thread queing, looking for thoughts
This is currently all I have (because I don't wanna accidentally crash my computer if possible):
Code:
typedef struct zque {
int id;
int ret;
_Bool active;
uint thread;
uint glance, change;
} zque_t;
#define zque_null ((zque_t){-1,0})
int zque_get_change_perm( zque_t *zque, uint sec )
{
uint change = ++(zque->change);
while ( zque->thread != change )
{
sleep(sec);
if ( !(zque->active) ) return -1;
}
return 0;
}
Aside from naming convention (I'll probably change that 'z' to 'mcc_' later), what are your thoughts on this? Any potential problems you can see?
Edit: Just noticed a left over from when I initially planned to work with an fd, removed now